github statelyai/xstate xstate@4.15.0

3 years ago

Minor Changes

  • 6596d0ba #1622 Thanks @davidkpiano! - Spawned/invoked actors and interpreters are now typed as extending ActorRef (e.g., SpawnedActorRef) rather than Actor or Interpreter. This unification of types should make it more straightforward to provide actor types:

    import {
    - Actor
    + ActorRef
    } from 'xstate';
    
    // ...
    
    interface SomeContext {
    - server?: Actor;
    + server?: ActorRef<ServerEvent>;
    }

    It's also easier to specify the type of a spawned/invoked machine with ActorRefFrom:

    import {
      createMachine,
    - Actor
    + ActorRefFrom
    } from 'xstate';
    
    const serverMachine = createMachine<ServerContext, ServerEvent>({
      // ...
    });
    
    interface SomeContext {
    - server?: Actor; // difficult to type
    + server?: ActorRefFrom<typeof serverMachine>;
    }

Patch Changes

  • 75a91b07 #1692 Thanks @Andarist! - Fixed an issue with history state entering a wrong state if the most recent visit in its parent has been caused by a transient transition.

Don't miss a new xstate release

NewReleases is sending notifications on new releases.