Major Changes
-
#4306
30e3cb216
Thanks @Andarist! - The finaloutput
of a state machine is now specified directly in theoutput
property of the machine config:const machine = createMachine({ initial: 'started', states: { started: { // ... }, finished: { type: 'final' // moved to the top level // // output: { // status: 200 // } } }, // This will be the final output of the machine // present on `snapshot.output` and in the done events received by the parent // when the machine reaches the top-level final state ("finished") output: { status: 200 } });
Minor Changes
-
#4172
aeef5e2d0
Thanks @davidkpiano! - TheonSnapshot: { ... }
transition object is now supported for invoked machines, observables, promises, and transition functions:const machine = createMachine({ // ... invoke: [ { src: createMachine({ ... }), onSnapshot: { actions: (context, event) => { event.snapshot; // machine state } } }, { src: fromObservable(() => ...), onSnapshot: { actions: (context, event) => { event.snapshot; // observable value } } }, { src: fromTransition((state, event) => { ... }, /* ... */), onSnapshot: { actions: (context, event) => { event.snapshot; // transition function return value } } } ] });
Patch Changes
- #4307
0c7b3aa3d
Thanks @davidkpiano! - Theinput
of a callback actor created withfromCallback(...)
will now be properly restored when the actor is persisted.