Minor Changes
-
#3289
c0a147e25
Thanks @Andarist! - A newpredictableActionArguments
feature flag has been added that allows you to opt into some fixed behaviors that will be the default in v5. With this flag:- XState will always call an action with the event directly responsible for the related transition,
- you also automatically opt-into
preserveActionOrder
.
Please be aware that you might not able to use
state
from themeta
argument when using this flag. -
#3126
37b751cb3
Thanks @Andarist! - Allexit
actions in the machine will now be correctly resolved and executed when a machine gets stopped or reaches its top-level final state. Previously, the actions were not correctly resolved and that was leading to runtime errors.To implement this fix in a reliable way, a new internal event has been introduced:
{ type: 'xstate.stop' }
and when the machine stops its execution, all exit handlers of the current state (i.e. the active state nodes) will be called with that event. You should always assume that an exit handler might be called with that event.
Patch Changes
-
#3178
6badd2ba3
Thanks @davidkpiano! - Added a dev-only error whenforwardTo
accidentally ends up trying to forward an event to an undefined actor. Such a situation indicates a logical error and risks an infinite loop. -
#3453
368ed9b1c
Thanks @pixtron! - Call thecomplete
callback of the subscribedobserver
when an interpreter gets stopped. -
#3422
e35493f59
Thanks @Andarist! - Fixed an issue with parallel regions not always being correctly reentered on external transitions of the containing parallel state targeting another region within that parallel state. -
#3447
e93754d7a
Thanks @davidkpiano! - The types forstate.nextEvents
are now properly typed to the actual event types of the machine. Original PR: #1115 (Thanks @alexreardon!) -
#3424
88d540eb8
Thanks @Andarist! - Fixed an issue with targeted ancestors not being correctly reentered during external transitions.