github statelyai/xstate xstate@4.31.0

latest releases: @xstate/vue@4.0.0, @xstate/store@2.6.1, @xstate/svelte@4.0.0...
2 years ago

Minor Changes

  • #3190 fbf5ca0ad Thanks @davidkpiano! - 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
  • #3200 56c0a36 Thanks @Andarist! - Subscribing to a stopped interpreter will now always immediately emit its state and call a completion callback.

Patch Changes

  • #3166 be4c5c74d Thanks @Andarist! - 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.

  • #3171 14f8b4785 Thanks @Andarist! - Fixed an issue with onDone on parallel states not being "called" correctly when a parallel state had a history state defined directly on it.

  • #2939 360e85462 Thanks @Andarist! - Fixed issues with not disposing some cached internal values when stopping interpreters, which could have led to issues when starting such an interpreter again.

  • #3153 b36ef9dda Thanks @Andarist! - Made type displays (like in the IDE tooltips etc) more readable by using a type interface for the internal ResolveTypegenMeta type.

Don't miss a new xstate release

NewReleases is sending notifications on new releases.