github statelyai/xstate xstate@5.0.0-beta.30

latest releases: @xstate/svelte@3.0.5, @xstate/vue@3.1.4, @xstate/store@2.6.0...
pre-release12 months ago

Major Changes

  • #4299 bd9a1a599 Thanks @Andarist! - All actor snapshots now have a consistent, predictable shape containing these common properties:

    • status: 'active' | 'done' | 'error' | 'stopped'
    • output: The output data of the actor when it has reached status: 'done'
    • error: The error thrown by the actor when it has reached status: 'error'
    • context: The context of the actor

    This makes it easier to work with actors in a consistent way, and to inspect their snapshots.

    const promiseActor = fromPromise(async () => {
      return 42;
    });
    
    // Previously number | undefined
    // Now a snapshot object with { status, output, error, context }
    const promiseActorSnapshot = promiseActor.getSnapshot();
    
    if (promiseActorSnapshot.status === 'done') {
      console.log(promiseActorSnapshot.output); // 42
    }

Don't miss a new xstate release

NewReleases is sending notifications on new releases.