StateManger: Cannot transition to another state in the enter() method #2400

Closed
vanthome opened this Issue Apr 4, 2013 · 4 comments

Projects

None yet

3 participants

Contributor
vanthome commented Apr 4, 2013

I have a StateManger with an initialState which has an enter() method.
If I wan to transition to another state from this method, the StateManager instance is left screwed up and next time is send() a signal of the target state, I get

TATEMANAGER: Unhandled event 'authenticate' being sent to state (null).

I don't think that the state should be 'null' in a FSM implementation... this is catually
an illegal state.

Ember 1.0.0rc2

Owner
wagenet commented Apr 11, 2013

Implement a redirect method in your route and transition from there instead.

@wagenet wagenet closed this Apr 11, 2013
Contributor

Is this advice also true if I'm not talking about a router here? My use-case is a State Manger which is used as a controller.

Member

I usually put my transitionTo within an Ember.run.next.

The reason this is an issue is that enter is called as part of the transition process, so delaying until the next run loop allows the state manager to finishing transitioning before starting the next transition.

Contributor

@lukemelia , Yes! Em.run.next() did the trick.
I also can comprehend your explanation.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment