Repository navigation
Replies: 1 comment
|
There is no For observing those intermediate states, use the inspection API's microstep events: import { createActor, createMachine } from 'xstate';
const machine = createMachine({
initial: 'outside',
states: {
outside: { on: { UP: 'outsideUp' } },
outsideUp: { always: 'outside' },
},
});
const actor = createActor(machine, {
inspect(event) {
if (event.type === '@xstate.microstep') {
console.log(event.snapshot.value);
}
},
});
actor.start();
actor.send({ type: 'UP' });This observes Inspection is useful for tracing and debugging. If your component needs Tested with XState 5.33.2. The v5 microstep event includes the intermediate snapshot. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
If I have a machine state like
and I subscribe to state changes like so:
I do not get updates from the 'pass-through' state that has an always transition.
Is there a configuration flag I can get to ensure these 'pass-through' states are part of my subscription?
I know I can fire events, but this leads to a separation of concerns for how I handle states in my component.
Feels like an anti-pattern.
Thanks for your help.
All reactions