@xstate/store@4.3.0-alpha.1
Pre-release
Pre-release
·
0 commits
to main
since this release
Patch Changes
-
c3f7a9d: Actor logic now returns effects from both regular and initial transitions.
Hand-written actor logic should return
[snapshot, effects]fromtransition(...)and provideinitialTransition(...)for creating the initial[snapshot, effects]tuple.getInitialSnapshot(...)remains available for snapshot-only reads.const logic = { transition: (snapshot, event) => [snapshot, []], initialTransition: (input, _scope) => [ { status: 'active', output: undefined, error: undefined, input }, [] ], getInitialSnapshot: (scope, input) => logic.initialTransition(input, scope)[0] };
transition(...)andinitialTransition(...)continue to return[snapshot, actions]for machine logic.fromStore(...)effects now run after the actor snapshot is committed, so effect callbacks read the updated snapshot fromenqueue.getSnapshot().