Stately
XState v6 alpha

Server rendering

Use XState actors with server-rendered Svelte.

Create actors per request. Do not keep one running actor in a server module.

Serialize a persisted snapshot on the server and restore it when the component starts in the browser.

const actor = useActor(machine, { snapshot: restoredSnapshot });

Start browser-only effects after hydration.

For example, restore an order actor from the database for one request, or send a persisted checkout snapshot with the page so the browser resumes the same step.