Please review this code snippet:
const parentMachine = createMachine({
predictableActionArguments: true,
id: 'parent',
initial: 'nested',
states: {
nested: {
initial: 'idle',
states: {
idle: {},
done: {
type: 'final',
},
},
on: {
Go: '.done',
Reset: '.idle',
GoOutside: 'outside',
},
},
outside: {},
},
});
I initially believed that the transition from nested.done to nested.idle would be restricted since nested.done is a final state.
Similarly, I expected that the GoOutside event could trigger a transition from nested.done to outside since nested.done is a locally final state, and it shouldn't affect transitions between parent states.
However, I noticed that both transitions are possible.
Surprisingly, the Reset event can transition from nested.done to nested.idle. Now, I'm questioning my understanding of the final state concept. What am I overlooking?