xstate
5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed
Your version
5.33.4 is the newest release of 5.x.
In short
2 new
Release note
Minor Changes
Add
mapState(snapshot, mapper)to map a snapshot to values based on active state(s).import { mapState } from 'xstate'; const results = mapState(snapshot, { states: { loading: { map: () => 'Loading...' }, success: { map: (snap) => snap.context.data }, error: { map: (snap) => snap.context.error.message } } }); console.log(results); // E.g. if snapshot.value === 'loading', then: // [ // { stateNode: { key: 'loading' }, result: 'Loading...' } // ]Add
maxIterationsoption to configure the maximum number of microsteps allowed before throwing an infinite loop error. The default isInfinity(no limit) to avoid breaking existing machines.You can configure it when creating a machine:
const machine = createMachine({ // ... machine config options: { maxIterations: 1000 // set a limit to enable infinite loop detection } });
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.