Skip to content

xstate@5.0.0-beta.20

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 28 Jul 14:02
· 418 commits to main since this release
f0694cb

Major Changes

  • #4036 e2440f0b1 Thanks @davidkpiano! - Actor types can now be specified in the .types property of createMachine:

    const fetcher = fromPromise(() => fetchUser());
    
    const machine = createMachine({
      types: {} as {
        actors: {
          src: 'fetchData'; // src name (inline behaviors ideally inferred)
          id: 'fetch1' | 'fetch2'; // possible ids (optional)
          logic: typeof fetcher;
        };
      },
      invoke: {
        src: 'fetchData', // strongly typed
        id: 'fetch2', // strongly typed
        onDone: {
          actions: ({ event }) => {
            event.output; // strongly typed as { result: string }
          }
        },
        input: { foo: 'hello' } // strongly typed
      }
    });

Minor Changes

  • #4157 31eb5f8a1 Thanks @Valkendorm! - Merge sendBack and receive with other properties of fromCallback logic creator.

    const callbackLogic = fromCallback(({ input, system, self, sendBack, receive }) => { ... });