XState 6.0.0-alpha.66

6.0.0-alpha.66Pre-release
Fixed 6
  • Fix declaration generation for exported machine.provide({ actions }) variants and createStateConfig() fragments with invoke input mappers
  • Entry and exit functions receive a working enq regardless of their parameter count, including default/rest parameters and forwarding wrappers
  • Returned context and child patches are applied consistently for entry and exit functions
  • Functions that enqueue no effects no longer add placeholder effects to pure transition results
  • Fix nested and parallel state value inference for machines declaring setup({ states }) when exactOptionalPropertyTypes is enabled
  • Both forms of snapshot.matches(...) accept valid nested states, such as snapshot.matches({ b: 'x' }) and snapshot.matches('b.x')

From XState

Patch Changes
  • d175de9: Fix declaration generation for exported machine.provide({ actions }) variants and createStateConfig() fragments with invoke input mappers.

    Entry and exit functions now receive a working enq regardless of their parameter count, including default/rest parameters and forwarding wrappers. Returned context and child patches are applied consistently. Functions that enqueue no effects no longer add placeholder effects to pure transition results.

    import { createMachine } from 'xstate';
    
    const machine = createMachine({
      initial: 'loading',
      states: {
        loading: {
          entry: (...[, enq]) => enq.raise({ type: 'ready' }),
          on: { ready: { target: 'ready' } }
        },
        ready: {}
      }
    });
    
  • 32487c8: Fix nested and parallel state value inference for machines declaring setup({ states }) when exactOptionalPropertyTypes is enabled. Both forms of snapshot.matches(...) now accept valid nested states:

    snapshot.matches({ b: 'x' });
    snapshot.matches('b.x');
    
View original

Upgraded? How did it go?

Discussion