github statelyai/xstate xstate@4.13.0

3 years ago

Minor Changes

  • f51614df #1409 Thanks @jirutka! - Fix type ExtractStateValue so that it generates a type actually describing a State.value

Patch Changes

  • b1684ead #1402 Thanks @Andarist! - Improved TypeScript type-checking performance a little bit by using distributive conditional type within TransitionsConfigArray declarations instead of a mapped type. Kudos to @amcasey, some discussion around this can be found here

  • ad3026d4 #1407 Thanks @tomenden! - Fixed an issue with not being able to run XState in Web Workers due to assuming that window or global object is available in the executing environment, but none of those are actually available in the Web Workers context.

  • 4e949ec8 #1401 Thanks @Andarist! - Fixed an issue with spawned actors being spawned multiple times when they got spawned in an initial state of a child machine that is invoked in the initial state of a parent machine.

    Illustrating example for curious readers.
    const child = createMachine({
      initial: 'bar',
      context: {},
      states: {
        bar: {
          entry: assign({
            promise: () => {
              return spawn(() => Promise.resolve('answer'));
            }
          })
        }
      }
    });
    
    const parent = createMachine({
      initial: 'foo',
      states: {
        foo: {
          invoke: {
            src: child,
            onDone: 'end'
          }
        },
        end: { type: 'final' }
      }
    });
    
    interpret(parent).start();

Don't miss a new xstate release

NewReleases is sending notifications on new releases.