Minor Changes
-
#4198
ca58904ad
Thanks @davidkpiano! - IntroducetoPromise(actor)
, which creates a promise from anactor
that resolves with the actor snapshot'soutput
when done, or rejects with the actor snapshot'serror
when it fails.import { createMachine, createActor, toPromise } from 'xstate'; const machine = createMachine({ // ... states: { // ... done: { type: 'final', output: 42 } } }); const actor = createActor(machine); actor.start(); const output = await toPromise(actor); console.log(output); // => 42
Patch Changes
-
#4568
a5c55fae2
Thanks @Andarist! - Fixed an issue withspawn
withinassign
not returning a narrowed downActorRef
type on TypeScrip 5.0 -
#4570
c11127336
Thanks @Andarist! - Fixed an issue that caused acomplete
listener to be called instead of theerror
one when the actor was subscribed after being stopped.