github statelyai/xstate xstate@6.0.0-alpha.2

pre-release4 hours ago

Patch Changes

  • #44 d6a537e Thanks @pull! - Fixed a bug where an invoked actor's input (and a dynamic src function) received the context from before the transition that entered the invoking state, rather than the updated context. Now, when a transition updates context and targets a state that invokes an actor, the actor's input sees the updated context — consistent with that state's entry actions.

    const machine = createMachine({
      context: { value: 0 },
      initial: 'idle',
      states: {
        idle: {
          on: {
            start: () => ({ target: 'active', context: { value: 100 } })
          }
        },
        active: {
          invoke: {
            src: asyncLogic,
            // now receives { value: 100 } instead of { value: 0 }
            input: ({ context }) => ({ val: context.value })
          }
        }
      }
    });

Don't miss a new xstate release

NewReleases is sending notifications on new releases.