statelyai / xstate

Actor-based state management & orchestration for complex app logic.
https://stately.ai/docs
MIT License
27.21k stars 1.26k forks source link

[core] Synchronizers #5071

Open davidkpiano opened 2 months ago

davidkpiano commented 2 months ago

Added support for synchronizers in XState, allowing state persistence and synchronization across different storage mechanisms.

import { createActor } from 'xstate';
import { someMachine } from './someMachine';
import { createLocalStorageSync } from './localStorageSynchronizer';

const actor = createActor(someMachine, {
  sync: createLocalStorageSync('someKey')
});
changeset-bot[bot] commented 2 months ago

🦋 Changeset detected

Latest commit: 03854c382ecf76ac79a86f91543701502c38d22b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages | Name | Type | | -------------- | ----- | | xstate | Minor | | @xstate/graph | Major | | @xstate/react | Major | | @xstate/solid | Major | | @xstate/svelte | Major | | @xstate/vue | Major |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR