github statelyai/xstate xstate@5.0.0-beta.8

latest releases: @xstate/solid@0.2.3, @xstate/svelte@3.0.5, @xstate/vue@3.1.4...
pre-release18 months ago

Major Changes

  • #898 26986f417 Thanks @davidkpiano! - Sending a string event to actor.send('some string') will now throw a proper error message.

  • #3957 423c5ab72 Thanks @davidkpiano! - The machine .schema property is now .types:

    const machine = createMachine({
      // schema: { ... }
      types: {} as {
        context: { ... };
        events: { ... };
        // ...
      }
    });

    And the .tsTypes property is now .types.typegen:

    const machine = createMachine({
      // tsTypes: { ... }
      types: {} as {
        typegen: {};
        context: { ... };
        events: { ... };
        // ...
      }
    });
  • #3968 eecb31b8f Thanks @davidkpiano! - The createEmptyActor() function has been added to make it easier to create actors that do nothing ("empty" actors). This is useful for testing, or for some integrations such as useActor(actor) in @xstate/react that require an actor:

    import { createEmptyActor } from 'xstate';
    
    const SomeComponent = (props) => {
      // props.actor may be undefined
      const [state, send] = useActor(props.actor ?? createEmptyActor());
    
      // ...
    };
  • #3966 61db63bf4 Thanks @davidkpiano! - You can now import the following from xstate:

    import {
      // actions
      // sendTo (removed)
      pure,
    
      // interpret helpers
      waitFor,
    
      // actor functions
      fromPromise,
      fromObservable,
      fromCallback,
      fromEventObservable,
      fromTransition,
    
      // guard functions
      stateIn,
      not,
      and,
      or
    }

    The send action was removed from exports; use sendTo(...) or raise(...) instead.

Patch Changes

  • #3959 ead287257 Thanks @davidkpiano! - Unresolved promises will now be properly persisted. The current behavior is to restart a promise that is unresolved.

Don't miss a new xstate release

NewReleases is sending notifications on new releases.