nodename/stately

entry-actions should fire after transition action

jiangts opened this issue · 1 comments

Suppose you're given the following configuration

{
:states {:fsm/A {:entry-actions [[:fsm/action1]]
                 :exit-actions [[:fsm/action2]]}}
:transitions {[:fsm/A :event] {:target :fsm/A
                               :actions [[:fsm/action3]]}}
...
}

When the transition :event is fired on state :fsm/A, the expected order of actions dispatched should be
action2, action3, action1. In the given implementation, the order is action2, action1, action3.

I don't agree. The transition is supposed to conceptually take zero time; in other words, the system is not in a valid state if you access it between states, and there is no context in which an action can take place.
I believe it is standard for the transition action to take place in the context of the target state, although it would be valid (but not equivalent) if the other choice (context of the source state) were made consistently throughout.