github statelyai/xstate xstate@4.26.0

latest releases: @xstate/vue@4.0.0, @xstate/store@2.6.1, @xstate/svelte@4.0.0...
3 years ago

Minor Changes

  • #2672 8e1d05d Thanks @davidkpiano! - The description property is a new top-level property for state nodes and transitions, that lets you provide text descriptions:

    const machine = createMachine({
      // ...
      states: {
        active: {
          // ...
          description: 'The task is in progress',
          on: {
            DEACTIVATE: {
              // ...
              description: 'Deactivates the task'
            }
          }
        }
      }
    });

    Future Stately tooling will use the description to render automatically generated documentation, type hints, and enhancements to visual tools.

  • #2743 e268bf34a Thanks @janovekj! - Add optional type parameter to narrow type returned by EventFrom. You can use it like this:

    type UpdateNameEvent = EventFrom<typeof userModel>;

Patch Changes

  • #2738 942fd90e0 Thanks @michelsciortino! - The tags property was missing from state's definitions. This is used when converting a state to a JSON string. Since this is how we serialize states within @xstate/inspect this has caused inspected machines to miss the tags information.

  • #2740 707cb981f Thanks @Andarist! - Fixed an issue with tags being missed on a service state after starting that service using a state value, like this:

    const service = interpret(machine).start('active');
    service.state.hasTag('foo'); // this should now return a correct result
  • #2691 a72806035 Thanks @davidkpiano! - Meta data can now be specified for invoke configs in the invoke.meta property:

    const machine = createMachine({
      // ...
      invoke: {
        src: (ctx, e) => findUser(ctx.userId),
        meta: {
          summary: 'Finds user',
          updatedAt: '2021-09-...',
          version: '4.12.2'
          // other descriptive meta properties
        }
      }
    });

Don't miss a new xstate release

NewReleases is sending notifications on new releases.