Minor Changes
-
#4329
41f5a7dc5
Thanks @davidkpiano! - You can nowspawn(...)
actors directly outside ofassign(...)
action creators:import { createMachine, spawn } from 'xstate'; const listenerMachine = createMachine({ // ... }); const parentMachine = createMachine({ // ... on: { 'listener.create': { entry: spawn(listenerMachine, { id: 'listener' }) } } // ... }); const actor = createActor(parentMachine).start(); actor.send({ type: 'listener.create' }); actor.getSnapshot().children.listener; // ActorRefFrom<typeof listenerMachine>
-
#4257
531a63482
Thanks @Andarist! - Action parameters can now be directly accessed from the 2nd argument of the action implementation:const machine = createMachine( { // ... entry: { type: 'greet', params: { message: 'hello' } } }, { actions: { greet: (_, params) => { params.message; // 'hello' } } } );
-
#4257
531a63482
Thanks @Andarist! - Guard parameters can now be directly accessed from the 2nd argument of the guard implementation:const machine = createMachine( { // ... on: { EVENT: { guard: { type: 'isGreaterThan', params: { value: 10 } } } } }, { guards: { isGreaterThan: (_, params) => { params.value; // 10 } } } );
Patch Changes
-
#4405
a01169eb2
Thanks @Andarist! - Fixed crash on asystemId
synchronous re-registration attempt that could happen, for example, when dealing with reentering transitions. -
#4401
eea74c594
Thanks @Andarist! - Fixed the issue with stopped state machines not updating their snapshots with that information. -
#4403
3f84bba72
Thanks @Andarist! - Fixed an issue with rehydrated actors not registering themselves in the system.