Patch Changes
-
4d9ba1c: Spawning a child with
enq.spawn(...)from a transition function now creates and starts the child actor exactly once for the committed transition.const machine = createMachine({ on: { spawn: (_, enq) => { enq.spawn(childMachine, { registryKey: 'child' }); } } });
-
6798cb1:
serializeMachine(...)andcreateMachineFromConfig(...)now represent inline functions (guards, actions, transitions, delays, route functions) as{ '@code': string, '@lang': 'ts' }. Non-portable values such as actor logic, runtime schemas, class instances, symbols, and bigints are omitted from the serialized JSON.import { serializeMachine } from 'xstate'; serializeMachine(machine); // inline functions → { '@code': '() => true', '@lang': 'ts' }
Type-only refinements:
voidandundefinedare accepted as type-only schemas, async logic output is inferred from an input-only schema, actions/guards can be typed viaschemas, andtriggeris correctly typed on spawned actors.