Skip to content

xstate@6.0.0-alpha.49

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 25 Aug 23:49
· 3 commits to main since this release
57d79e5

Minor Changes

  • 501c5e3: Add the self-contained xstate/fsm entry point for compact flat finite state
    machines. It exports createFSM and createFSMActor without including the full
    statechart actor runtime.

    import { createFSM, createFSMActor } from 'xstate/fsm';
    
    const logic = createFSM({
      initial: 'inactive',
      states: {
        inactive: { on: { toggle: { target: 'active' } } },
        active: { on: { toggle: { target: 'inactive' } } }
      }
    });
    
    const actor = createFSMActor(logic).start();

    The FSM runtime also supports guarded transitions, context, actions, eventless
    transitions, final states, child actors, delayed events, and snapshot
    persistence for state, context, and self-directed timers. Live inline children
    and timers targeting other actors are rejected at the persistence boundary
    because the compact runtime has no registered actor-source registry.