Open
Description
XState version
XState version 5
Description
Sequence of events:
- Create a machine with children (either one or multiple of the same type)
- Create an actor and initialize the children machines through events of their parent
- Call
getPersistsedSnapshot
- Try to create new actor from that snapshot
- If you reuse the same object, actor works fine and you can call
getPersistedSnapshot
on a new actor - If you don't reuse it, and instead go through
JSON.parse(JSON.serialize(...))
,getPersistedSnapshot
crashes when calling on a new actor.
Expected result
Restored actors continue to be persistable
Actual result
Restored actors fail to persist their children
Reproduction
https://codesandbox.io/p/devbox/gracious-jerry-njrg8n
Additional context
xstate 5.18.1 (latest)