Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Initial state can't be restored for machines with transitioned child machines #3547

Closed
AlexGusew opened this issue Aug 25, 2022 · 2 comments

Comments

@AlexGusew
Copy link

AlexGusew commented Aug 25, 2022

Description

Let's say we have root machine that creates child machines and transits their state.
If we serialize this state, deserialize it, and then try to use useMachine hook from @xstate/react with options.state set to deserialized state, we will get the following error:

Unable to send event to child 'Child id' from service '(machine)'.

Expected result

No errors, parent and child stated are deserialized correctly

Actual result

The error is emitted

Reproduction

https://codesandbox.io/s/keen-nobel-i8mymo?file=/src/App.tsx

Additional context

Steps to reproduce the issue in the codesandbox:

  1. Press 'Spawn child'
  2. Press 'Move children to second state'
  3. Reload the sandboxed page
  4. Expect error
@davidkpiano
Copy link
Member

Recursive persistence is addressed here: #3743

@davidkpiano
Copy link
Member

This should now be working as expected in xstate@beta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants