Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.3k
Wait for state with always transition#5374
-
Hi! For state that have only Since Sandbox (open devtools console in browser to see logs):https://stackblitz.com/edit/vitejs-vite-fb8gt9ws?file=src%2Fmain.js |
BetaWas this translation helpful?Give feedback.
All reactions
You can use the inspection API and listen for@xstate.microstep inspection events:https://stately.ai/docs/inspection
constactor=createActor(machine,{inspect:(inspectionEv)=>{if(inspectionEv.type==='@xstate.microstep'){// ...
Replies: 3 comments
-
You can use the inspection API and listen for constactor=createActor(machine,{inspect:(inspectionEv)=>{if(inspectionEv.type==='@xstate.microstep'){// ... |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
@davidkpiano Hi! I just want to clarify - if there is no way to use the inspection api, it is not possible to track machine state with I should mention that only Using zero delay: conststates={//..."current target":{after:{0:"next target"}}}awaitwaitFor(actor,(snapshot)=>{returnsnapshot.matches("current target");}); Using extra event just for delaying transition: conststates={//..."current target":{on:{"#intermediate proceed":"next target"}}}awaitwaitFor(actor,(snapshot)=>{returnsnapshot.matches("current target");});actor.send({type:"#intermediate proceed"}); |
BetaWas this translation helpful?Give feedback.
All reactions
-
That's right - examining this is only currently possible through the inspection API. If you have access to the actor, you can inspect via |
BetaWas this translation helpful?Give feedback.