Packages

xstate

5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed

Your version

4.33.0

5 Aug 2022Where it was published

4.38.3 is the newest release of 4.x.

In short

4 new4 fixed

Release note

Minor Changes

  • A new predictableActionArguments feature flag has been added that allows you to opt into some fixed behaviors that will be the default in v5. With this flag:

    • XState will always call an action with the event directly responsible for the related transition,

    • you also automatically opt-into preserveActionOrder.

    Please be aware that you might not able to use state from the meta argument when using this flag.

  • All exit actions in the machine will now be correctly resolved and executed when a machine gets stopped or reaches its top-level final state. Previously, the actions were not correctly resolved and that was leading to runtime errors.

    To implement this fix in a reliable way, a new internal event has been introduced: { type: 'xstate.stop' } and when the machine stops its execution, all exit handlers of the current state (i.e. the active state nodes) will be called with that event. You should always assume that an exit handler might be called with that event.

Patch Changes

  • Added a dev-only error when forwardTo accidentally ends up trying to forward an event to an undefined actor. Such a situation indicates a logical error and risks an infinite loop.

  • Call the complete callback of the subscribed observer when an interpreter gets stopped.

  • Fixed an issue with parallel regions not always being correctly reentered on external transitions of the containing parallel state targeting another region within that parallel state.

  • The types for state.nextEvents are now properly typed to the actual event types of the machine. Original PR: #1115 (Thanks @alexreardon!)

  • Fixed an issue with targeted ancestors not being correctly reentered during external transitions.

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.