Description
The stateIn guard helper does not parse strings starting with #id, where "id" is an ID assigned to a parallel state.
// a parallel state region with an ID
B: {
id: 'b',
states: {
B1: {},
},
},
// elsewhere
guard: stateIn('#b.B1'), // ❌ the guard returns false even if the machine is in #b.B1
Expected result
The string passed to stateIn is correctly parsed. If a string starts with #id, the id is recognized if it is assigned to a state node within the current machine. The guard should pass.
Actual result
The guard did not pass.
Reproduction
https://codesandbox.io/s/pensive-rumple-w9wsdj?file=/src/index.js
Additional context
The stateIn guard works correctly only in the following scenarios:
guard: stateIn('B.B1'), // ✅
guard: stateIn('#root.B.B1'), // ✅ the string starts with an ID defined at the top level of the machine config
guard: stateIn({ B: 'B1' }) // ✅
Description
The
stateInguard helper does not parse strings starting with#id, where "id" is an ID assigned to a parallel state.Expected result
The string passed to
stateInis correctly parsed. If a string starts with#id, the id is recognized if it is assigned to a state node within the current machine. The guard should pass.Actual result
The guard did not pass.
Reproduction
https://codesandbox.io/s/pensive-rumple-w9wsdj?file=/src/index.js
Additional context
The stateIn guard works correctly only in the following scenarios: