github statelyai/xstate xstate@5.0.0-alpha.1

latest releases: @xstate/vue@4.0.0, @xstate/store@2.6.1, @xstate/svelte@4.0.0...
pre-release22 months ago

Major Changes

  • #3455 ec39214c8 Thanks @davidkpiano! - The interpreter.onStop(...) method has been removed. Use an observer instead via interpreter.subscribe({ complete() { ... } }) instead.

  • #3455 ec39214c8 Thanks @davidkpiano! - The .send(...) method on interpreter.send(...) now requires the first argument (the event to send) to be an object; that is, either:

    • an event object (e.g. { type: 'someEvent' })
    • an SCXML event object.

    The second argument (payload) is no longer supported, and should instead be included within the object:

    -actor.send('SOME_EVENT')
    +actor.send({ type: 'SOME_EVENT' })
    
    -actor.send('EVENT', { some: 'payload' })
    +actor.send({ type: 'EVENT', some: 'payload' })
  • #3455 ec39214c8 Thanks @davidkpiano! - Reading the initial state from an actor via actor.initialState is removed. Use actor.getInitialState() instead.

  • #3455 ec39214c8 Thanks @davidkpiano! - The matchState(...) helper function is removed.

  • #3455 ec39214c8 Thanks @davidkpiano! - The strict: true option for machine config has been removed.

  • #3455 ec39214c8 Thanks @davidkpiano! - The interpreter.onError(...) method has been removed. Use interpreter.subscribe({ error(err) => { ... } }) instead.

  • #3455 ec39214c8 Thanks @davidkpiano! - Interpreter['off'] method has been removed.

  • #3455 ec39214c8 Thanks @davidkpiano! - .nextState method has been removed from the Interpreter. State#can can be used to check if sending a particular event would lead to a state change.

  • #3187 c800dec47 Thanks @davidkpiano! - The createModel() function has been removed in favor of relying on strong types in the machine configuration.

  • #3455 ec39214c8 Thanks @davidkpiano! - sync option has been removed from invoke and spawn.

Minor Changes

  • #3727 5fb3c683d Thanks @Andarist! - exports field has been added to the package.json manifest. It limits what files can be imported from a package - it's no longer possible to import from files that are not considered to be a part of the public API.

Patch Changes

  • #3455 ec39214c8 Thanks @davidkpiano! - Fixed an issue with inline actions not being correctly executed when there was an equally named action provided through the implementations argument.

  • #3487 1b6e3dfb8 Thanks @Andarist, @davidkpiano! - Make it impossible to exit a root state. For example, this means that root-level transitions specified as external transitions will no longer restart root-level invocations. See #3072 for more details.

  • #3389 aa8f5d5fd Thanks @Andarist! - Fixed the declared signature of one of the StateMachine's methods to avoid using a private name this. This makes it possible to emit correct .d.ts for the associated file.

  • #3374 a990f0ed1 Thanks @Andarist! - Fixed an issue with actors not being reinstantiated correctly when an actor with the same ID was first stopped and then invoked/spawned again in the same microstep.

  • #3390 7abc41759 Thanks @Andarist! - Added back UMD builds. Please note that XState now comes with multiple entrypoints and you might need to load all of them (XState, XStateActions, XStateGuards, etc.). It's also worth mentioning that those bundles don't reference each other so they don't actually share any code and some code might be duplicated between them.

Don't miss a new xstate release

NewReleases is sending notifications on new releases.