Releases: statelyai/xstate
@xstate/[email protected]
Minor Changes
2590fb7
#1129 Thanks @davidkpiano! - Initial release for@xstate/immer
.
Patch Changes
[email protected]
Minor Changes
-
f3ff150
#1103 Thanks @davidkpiano! - Simplify theTransitionConfigArray
andTransitionConfigMap
types in order to fix excessively deep type instantiation TypeScript reports. This addresses #1015. -
6c47b66
#1076 Thanks @Andarist! - Added support for conditional actions. It's possible now to have actions executed based on conditions using following:entry: [ choose([ { cond: ctx => ctx > 100, actions: raise('TOGGLE') }, { cond: 'hasMagicBottle', actions: [assign(ctx => ({ counter: ctx.counter + 1 }))] }, { actions: ['fallbackAction'] } ]) ];
It works very similar to the if-else syntax where only the first matched condition is causing associated actions to be executed and the last ones can be unconditional (serving as a general fallback, just like else branch).
Patch Changes
-
1a129f0
#1073 Thanks @Andarist! - Cleanup internal structures upon receiving termination events from spawned actors. -
e88aa18
#1085 Thanks @Andarist! - Fixed an issue with data expressions of root's final nodes being called twice. -
88b17b2
#1090 Thanks @rjdestigter! - This change carries forward the typestate type information encoded in the arguments of the following functions and assures that the return type also has the same typestate type information:- Cloned state machine returned by
.withConfig
. .state
getter defined for services.start
method of services.
- Cloned state machine returned by
-
d5f622f
#1069 Thanks @davidkpiano! - Loosened event type forSendAction<TContext, AnyEventObject>
@xstate/[email protected]
Minor Changes
137b0cd
#1033 Thanks @ZempTime! - Added ESM build of the package which can be loaded through modern web bundlers (instead of default CommonJS files).
Patch Changes
- Updated dependencies [
f3ff150
,6c47b66
,1a129f0
,e88aa18
,88b17b2
,137b0cd
,d5f622f
]:- [email protected]
- @xstate/[email protected]
@xstate/[email protected]
@xstate/[email protected]
Minor Changes
3d50808
#1082 Thanks @davidkpiano! - The.state
property is now exposed on the service returned frominterpret(machine)
, which is a getter that returns the latest state of the machine.
Patch Changes
dcbd72f
#1122 Thanks @chancestrickland! -StateMachine.Config
type accepts now a third type parameter -TState
- similarly to other existing types. When provided it provides helpful intellisense when defining the state chart transitions.
[email protected]
Minor Changes
-
55aa589
#960 Thanks @davidkpiano! - The machine can now be safely JSON-serialized, usingJSON.stringify(machine)
. The shape of this serialization is defined inmachine.schema.json
and reflected inmachine.definition
.Note that
onEntry
andonExit
have been deprecated in the definition in favor ofentry
andexit
.
Patch Changes
[email protected]
Patch Changes
520580b
#967 Thanks @andrewgordstewart! - Add context & event types to InvokeConfig
@xstate/[email protected]
@xstate/[email protected]
[email protected]
Patch Changes
-
c8db035
#936 Thanks @davidkpiano! - Theescalate()
action can now take in an expression, which will be evaluated against thecontext
,event
, andmeta
to return the error data. -
2a3fea1
#952 Thanks @davidkpiano! - The typings for the raise() action have been fixed to allow any event to be raised. This typed behavior will be refined in version 5, to limit raised events to those that the machine accepts. -
f86d419
#957 Thanks @Andarist! - Fixed memory leak - each created service has been registered in internal map but it was never removed from it. Registration has been moved to a point where Interpreter is being started and it's deregistered when it is being stopped.