-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Description
XState version
XState version 5
Description
When using delays (after: { 1000: "myTarget" }), if the state machine is persisted during a delay and then restored by re-creating it from the snapshot, then the delay will never trigger.
Seems like the delay information is lost when snapshotting.
I've worked around it by using a fromPromise actor with a promise resolving after a setTimeout. The input of that actor is a deadline computed when it is created (Date.now() + delay in ms).
Expected result
The delay should be resumed and possibly trigger its resolution condition if it is past the expected time it should've completed.
Actual result
The delay never resolves and the state machine is stuck forever.
Reproduction
I didn't prepare any, but should be easy?
Additional context
No response