Packages

xstate

5.33.4 · 7 Nov 2026MIT9M / weekRepositoryHomepagenpmAtom feed

Your version

4.31.0

8 Apr 2022Where it was published

4.38.3 is the newest release of 4.x.

In short

2 new4 fixed

Release note

Minor Changes

  • The waitFor(...) helper function, which asynchronously waits for an actor's emitted value to satisfy a predicate before a timeout, is now available.

    Example usage:

    import { waitFor } from 'xstate/lib/waitFor';
    
    // ...
    const loginService = interpret(loginMachine).start();
    
    const loggedInState = await waitFor(loginService, state =>
      state.hasTag('loggedIn')
    );
    
    loggedInState.hasTag('loggedIn'); // true
  • Subscribing to a stopped interpreter will now always immediately emit its state and call a completion callback.

Patch Changes

  • Fixed an issue with state.tags not having correct values when resolving micro transitions (taken in response to raised events). This was creating issues when checking tags in guards.

  • Fixed an issue with onDone on parallel states not being "called" correctly when a parallel state had a history state defined directly on it.

  • Fixed issues with not disposing some cached internal values when stopping interpreters, which could have led to issues when starting such an interpreter again.

  • Made type displays (like in the IDE tooltips etc) more readable by using a type interface for the internal ResolveTypegenMeta type.

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.