Skip to content

@xstate/effect@0.1.0-alpha.4

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 28 Sep 14:54
· 9 commits to main since this release
e06f6e3

Patch Changes

  • 8576291: Remove the @xstate.deadletter inspection event; observe undelivered events with the onRejectedEvent option. The inspection protocol is now exactly @xstate.actor and @xstate.transition. In @xstate/effect, deadLetters(actor) now streams EventRejection objects.

    createActor(machine, {
      onRejectedEvent: (rejection) => {
        console.log(rejection.event.type, rejection.reason, rejection.issues);
      }
    });

    Undelivered events are also available through system.onRejectedEvent(listener), which accepts any number of listeners added at any time and returns a subscription. The onRejectedEvent option registers a listener the same way.

    const subscription = actor.system.onRejectedEvent((rejection) => {
      console.log(rejection.event.type, rejection.reason);
    });
    subscription.unsubscribe();