XState 6.0.0-alpha.49

6.0.0-alpha.49Pre-release
Added 2
  • Add the self-contained xstate/fsm entry point for compact flat finite state machines, exporting createFSM and createFSMActor without the full statechart actor runtime
  • FSM runtime supports guarded transitions, context, actions, eventless transitions, final states, child actors, delayed events, and snapshot persistence for state, context, and self-directed timers

From XState

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.

View original

Upgraded? How did it go?

Discussion