XState xstate@6.0.0-beta.0
XState v6 beta moves persisted actor restoration from `createActor` to `restoreActor` in the `xstate/persist` entry point, and adds snapshot and event validation during restoration. It also makes leftover v5 configuration and unsupported actor options throw, changes macrosteps to be unbounded by default, and improves diagnostics and TypeScript actor-ref types.
Users upgrading to XState v6, especially those restoring persisted actors or carrying v5 configuration and lifecycle event patterns, must update affected APIs and configuration.
Review the migration changes before upgrading; use `restoreActor` for persisted snapshots and update v5 configuration or lifecycle event patterns that now throw.
- 01Replace `createActor(machine, { snapshot: persisted })` with `restoreActor(machine, persisted)` imported from `xstate/persist`; pass the system through the third argument when restoring into a system.
- 02Replace `machine.snapshotSchema` and `machine.eventSchema` validation with `snapshotSchema(machine)` from `xstate/persist` and `eventSchema(machine)` from `xstate`.
- 03Declare implementations in `setup({ ... })` or pass them through `machine.provide({ ... })` instead of passing them to `createMachine`.
- 04Replace removed actor options with their stated replacements; for `systemId`, use `registryKey` and look up the actor with `system.get(registryKey)`.
- 05Replace v5 suffixed lifecycle event transitions with the category event type and use `matches` to select the child.
import { restoreActor } from 'xstate/persist';
const actor = restoreActor(machine, persisted);# community_signal
How useful is this release to your stack?
Sign in with GitHub to cast your vote.
You’ll return to this release, then choose your vote.