-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transition on 'final' states not picked up by transitionListener #251
Comments
This is the intended behavior:
https://www.w3.org/TR/scxml/#final And the (pseudocode) algorithm has this:
That
In other words, the transition from the With that said, I've encountered this "problem" before, and for debugging/logging purposes etc., it might be useful to introduce a new nextState.value;
// 'D'
nextState.microsteps;
// [
// State({
// value: { A: 'C' },
// events: ['done.state.A'], // raised events
// event: { type: 'C_EVENT' } // triggering event
// },
// State({
// value: 'D',
// events: [], // no more raised events
// event: { type: 'done.state.A' } // triggering event
// }
// ] Which would represent all the intermediate states traversed in the macrostep in order to get from, e.g., On the interpreter, we can also introduce service.onMicrostep(state => {
console.log(state.value);
});
service.send('C_EVENT');
// => { A: 'C' }
// => 'D' Would those be helpful? CC. @mogsie for more info on what we want to capture for debugging purposes. |
Indeed I understand it's only useful for debugging & logging purposes. Yes, adding microsteps would solve our issue in this case 👍 |
Related: #692 |
In the project I'm working on, we are using the transition listener to be notified of all transitions so we can store them in a history.
The problem is that when an event triggers a transition to a
final
state, the transition listener skips thatfinal
state and only mentions the state specified byonDone
in the parent FSM.Here's an example reproducing the behaviour:
The output of this test is the following:
The transition listener is capturing
C_EVENT
triggering a transition to stateD
without any mention of stateC
. Is it possible to be more granular and mention the transition fromB
toC
and then fromC
to `D?The text was updated successfully, but these errors were encountered: