github statelyai/xstate xstate@5.0.0-beta.38

latest releases: @xstate/svelte@3.0.5, @xstate/vue@3.1.4, @xstate/store@2.6.0...
pre-release11 months ago

Minor Changes

  • #4329 41f5a7dc5 Thanks @davidkpiano! - You can now spawn(...) actors directly outside of assign(...) 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 a systemId 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.

Don't miss a new xstate release

NewReleases is sending notifications on new releases.