Packages

xstate

5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed

Your version

5.27.0

11 Feb 2026Where it was published

5.33.4 is the newest release of 5.x.

In short

1 new

Release note

Minor Changes

  • Add getInitialMicrosteps(…) and getMicrosteps(…) functions that return an array of [snapshot, actions] tuples for each microstep in a transition.

    import { createMachine, getInitialMicrosteps, getMicrosteps } from 'xstate';
    
    const machine = createMachine({
      initial: 'a',
      states: {
        a: {
          entry: () => console.log('enter a'),
          on: {
            NEXT: 'b'
          }
        },
        b: {
          entry: () => console.log('enter b'),
          always: 'c'
        },
        c: {}
      }
    });
    
    // Get microsteps from initial transition
    const initialMicrosteps = getInitialMicrosteps(machine);
    // Returns: [
    //  [snapshotA, [entryActionA]]
    // ]
    
    // Get microsteps from a transition
    const microsteps = getMicrosteps(machine, initialMicrosteps[0][0], {
      type: 'NEXT'
    });
    // Returns: [
    //  [snapshotB, [entryActionB]],
    //  [snapshotC, []]
    // ]
    
    // Each microstep is a tuple of [snapshot, actions]
    for (const [snapshot, actions] of microsteps) {
      console.log('State:', snapshot.value);
      console.log('Actions:', actions.length);
    }

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.