6.0.0-alpha.40Pre-release
Changed 2
- Represent historical machine versions with Standard Schema snapshot and event descriptors instead of retaining their executable machines, with versioned machines exposing the same snapshotSchema and eventSchema interface
- Machine-backed snapshot schemas now default omitted history and timer records during migration
Fixed 1
- actor.getPersistedSnapshot() is now typed to the actor's logic so persist/restore round-trips through createActor(logic, { snapshot }) no longer require a cast
From XState
Minor Changes
-
107d0c2: Represent historical machine versions with Standard Schema snapshot and event descriptors instead of retaining their executable machines. Versioned machines expose the same
snapshotSchemaandeventSchemainterface. Machine-backed snapshot schemas default omitted history and timer records during migration.const versions = machineVersions([ { id: 'checkout', version: '1', snapshotSchema: checkoutV1Snapshot, eventSchema: checkoutV1Event }, checkoutV2 ]); const snapshot = await versions.migrateSnapshot(persisted, { to: '2', migrations: { '1': (snapshot) => ({ ...snapshot, context: { total: snapshot.context.count } }) } });
Patch Changes
-
2e77ff6:
actor.getPersistedSnapshot()is now typed to the actor’s logic, so persist/restore round-trips throughcreateActor(logic, { snapshot })no longer require a cast. Restoring a snapshot into a machine with a differentidis a type error, while snapshots from other versions of the same machine remain assignable (for runtime migration viamigrate).const actor = createActor(machine).start(); const snapshot = actor.getPersistedSnapshot(); // No cast needed: const restored = createActor(machine, { snapshot }).start();