node-zwave-js
node-zwave-js copied to clipboard
fix(deps): update dependency xstate to ^4.33.6
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| xstate (source) | ^4.29.0 -> ^4.33.6 |
Release Notes
statelyai/xstate
v4.33.6
Patch Changes
-
#3571
6fdaae710Thanks @davidkpiano! - Reading state directly from ~~someService.state~~ is deprecated. UsesomeService.getSnapshot()instead. -
#3555
4c13b3fafThanks @davidkpiano! - ThesendTo(actorName, event)action creator now accepts a stringactorName.
v4.33.5
Patch Changes
-
#3559
ddbc9bc5cThanks @Andarist! - Fixed minor compatibility issues with TypeScript 4.8 in the codebase. This fixes the typechecking with TypeScript 4.8 in projects that don't useskipLibCheck: true. -
#3563
e3c7a9cafThanks @Andarist! - Fixed an issue with not executing actions in response to received batched events when usingpredictableActionArguments. -
#3520
95a6a06d0Thanks @Andarist! - Fixed a runtime crash when sending multiple events as an array to a service. It is not recommended to use this feature though as it will be removed in the next major version.
v4.33.4
Patch Changes
- #3549
768c4e938Thanks @Andarist! - Fixed an issue with not being able to send events to initially started child actors when usingpredictableActionArguments.
v4.33.3
Patch Changes
-
#3540
121fad172Thanks @Andarist! - Fixed an issue that causedinvoked actors to be created before resolvingassignactions fromentryof the same state when usingpredictableActionArgumentsflag. -
#3541
6c081ab87Thanks @Andarist! - Fixed an issue with not being able to read the updated snapshot of a child when receiving and processing events from it and when usingpredictableActionArgumentsflag.
v4.33.2
Patch Changes
- #3523
129bcf927Thanks @Andarist! - Fixed a regression that caused child actors not being correctly stopped when their parent reached a final state.
v4.33.1
Patch Changes
- #3514
b451f5789Thanks @Andarist! - Fixed an issue with.nextState(event)calls accidentally executing actions in machines withpredictableActionArguments.
v4.33.0
Minor Changes
-
#3289
c0a147e25Thanks @Andarist! - A newpredictableActionArgumentsfeature 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
statefrom themetaargument when using this flag. -
#3126
37b751cb3Thanks @Andarist! - Allexitactions 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
6badd2ba3Thanks @davidkpiano! - Added a dev-only error whenforwardToaccidentally ends up trying to forward an event to an undefined actor. Such a situation indicates a logical error and risks an infinite loop. -
#3453
368ed9b1cThanks @pixtron! - Call thecompletecallback of the subscribedobserverwhen an interpreter gets stopped. -
#3422
e35493f59Thanks @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
e93754d7aThanks @davidkpiano! - The types forstate.nextEventsare now properly typed to the actual event types of the machine. Original PR: #1115 (Thanks @alexreardon!) -
#3424
88d540eb8Thanks @Andarist! - Fixed an issue with targeted ancestors not being correctly reentered during external transitions.
v4.32.1
Patch Changes
- #3292
16514e466Thanks @Andarist! - Fixed an issue in theEmittedFromtype helper that could prevent it from inferring the desired type from some services.
v4.32.0
Minor Changes
- #3234
ce376b388Thanks @Andarist! - Added aStateValueFromhelper that can be used to extract valid state values from a machine. This might specifically be useful with typegen because typegenlessstate.matchesacceptsanyanyway.
Patch Changes
-
#3215
44c66e74fThanks @tom-sherman! - Removing the timeout that's built in towaitForis now supported by explicitly passing anInfinityvalue.Example usage:
import { waitFor } from 'xstate/lib/waitFor'; // This will const loggedInState = await waitFor( loginService, state => state.hasTag('loggedIn'), { timeout: Infinity } );This fixes a bug that causes
waitForto reject with an error immediately due to the behaviour ofsetTimeout. -
#3230
780458c92Thanks @Andarist! - Fixed an issue with typegen types not being able to provide events that had a union of strings as theirtype(such as{ type: 'INC' | 'DEC'; value: number; }). -
#3252
a94dfd467Thanks @Andarist! - Fixed an issue withEventFromnot being able to extract events that had a union of strings as theirtype(such as{ type: 'INC' | 'DEC'; value: number; }). -
#3090
c4f73ca13Thanks @Andarist! - Fixed an issue with action objects not receiving correct event types when used in the second argument to thecreateMachine. -
#3238
3df6335efThanks @davidkpiano! - The typings forsendTo(...)have been fixed. -
#3228
fe5f0e6c9Thanks @Andarist! - Fixed an issue with inline functions in the config object used as transition actions not having their argument types inferred. -
#3252
a94dfd467Thanks @Andarist! - Fixed an issue with defaultTEvent({ type: string }) not being correctly provided to inline transition actions.
v4.31.0
Minor Changes
-
#3190
fbf5ca0adThanks @davidkpiano! - ThewaitFor(...)helper function, which asynchronously waits for an actor's emitted value to satisfy apredicatebefore atimeout, is now available.Example usage:
import { waitFor } from 'xstate/lib/waitFor'; // ... const loginService = interpret(loginMachine).start(); const loggedInState = await waitFor(loginService, state => state.hasTag('loggedIn') ); loggedInState.hasTag('loggedIn'); // true -
#3200
56c0a36Thanks @Andarist! - Subscribing to a stopped interpreter will now always immediately emit its state and call a completion callback.
Patch Changes
-
#3166
be4c5c74dThanks @Andarist! - Fixed an issue withstate.tagsnot having correct values when resolving micro transitions (taken in response to raised events). This was creating issues when checking tags in guards. -
#3171
14f8b4785Thanks @Andarist! - Fixed an issue withonDoneon parallel states not being "called" correctly when a parallel state had a history state defined directly on it. -
#2939
360e85462Thanks @Andarist! - Fixed issues with not disposing some cached internal values when stopping interpreters, which could have led to issues when starting such an interpreter again. -
#3153
b36ef9ddaThanks @Andarist! - Made type displays (like in the IDE tooltips etc) more readable by using a type interface for the internalResolveTypegenMetatype.
v4.30.6
Patch Changes
-
#3131
d9a0bcfc9Thanks @Andarist! - Fixed an issue with event type being inferred from too many places withincreateMachinecall and possibly ending up asany/AnyEventObjectfor the entire machine. -
#3133
4feef9d47Thanks @fw6! - Fixed compatibility with esoteric Mini Program environment whereglobalobject was available butglobal.consolewasn't. -
#3140
502ffe91aThanks @Andarist! - Fixed an issue with interpreters started using a persisted state not being "resolved" in full. This could cause some things, such asaftertransitions, not being executed correctly after starting an interpreter like this. -
#3147
155539c85Thanks @Andarist! - Fixed a TS inference issue causing some functions to infer the constraint type for the event type even though aStateMachinepassed to the function was parametrized with a concrete type for the event. More information can be found here. -
#3146
4cf89b5f9Thanks @Andarist! - Fixed compatibility ofInterpreterwith older versions of TypeScript. This ensures that our interpreters can correctly be consumed by functions expectingActorRefinterface (like for exampleuseSelector). -
#3139
7b45fda9eThanks @Andarist! -InterpreterFromandActorRefFromtypes used on machines with typegen data should now correctly return types with final/resolved typegen data. The "final" type here means a type that already encodes the information that all required implementations have been provided. Before this change this wouldn't typecheck correctly:const machine = createMachine({ // this encodes that we still expect `myAction` to be provided tsTypes: {} as Typegen0 }); const service: InterpreterFrom<typeof machine> = machine.withConfig({ actions: { myAction: () => {} } }); -
#3097
c881c8ca9Thanks @davidkpiano! - State that is persisted and restored frommachine.resolveState(state)will now have the correctstate.machinevalue, so thatstate.can(...)and other methods will work as expected. See #3096 for more details.
v4.30.5
Patch Changes
- #3118
28e353081Thanks @Andarist! - Fixed a bundling issue that prevented thekeys()export to be preserved in the previous release.
v4.30.4
Patch Changes
-
#3104
3706c62f4Thanks @Andarist! - FixedContextFromhelper type to work on typegened machines. -
#3113
144131bedThanks @davidkpiano! - Thekeys()utility function export, which was removed in #3089, is now added back, as older versions of XState libraries may depend on it still. See #3106 for more details. -
#3104
3706c62f4Thanks @Andarist! - FixedEventFromhelper type to work on machines.
v4.30.3
Patch Changes
-
#3088
9f02271a3Thanks @Andarist! - Added some internal@ts-ignorecomments to fix consuming projects that do not useskipLibCheck. -
#3082
8d3f2cfeaThanks @Andarist! - Fixed an issue with context type being inferred from too many places withincreateMachinecall and possibly ending up asanyfor the entire machine. -
#3027
97ad964bdThanks @hedgepigdaniel! - Fixed an issue with not being able to callcreateMachinein a generic context when the type for the context was generic and not concrete. -
#3084
50c271dc1Thanks @Andarist! - Fixed an issue with context type defined usingschema.contextbeing sometimes widened based onconfig.context. If both are given theschema.contextshould always take precedence and should represent the complete type of the context. -
#3089
862697e29Thanks @Andarist! - Fixed compatibility with Skypack by exporting some shared utilities from root entry of XState and consuming them directly in other packages (this avoids accessing those things using deep imports and thus it avoids creating those compatibility problems). -
#3087
ae9579497Thanks @Andarist! - Fixed an issue withActorRefFromnot resolving the typegen metadata from machine types given to it. This could sometimes result in types assignability problems, especially when using machine factories andspawn.
v4.30.2
Patch Changes
-
#3063
c826559b4Thanks @Andarist! - Fixed a type compatibility with Svelte's readables. It should be possible again to use XState interpreters directly as readables at the type-level. -
#3051
04091f29cThanks @Andarist! - Fixed type compatibility with functions accepting machines that were created before typegen was a thing in XState. This should make it possible to use the latest version of XState with@xstate/vue,@xstate/react@^1and some community packages.Note that this change doesn't make those functions to accept machines that have typegen information on them. For that the signatures of those functions would have to be adjusted.
-
#3077
2c76ecac5Thanks @Andarist! - Fixed an issue with nestedstate.matchescalls when the typegen was involved. Thestateended up beingneverand thus not usable.
v4.30.1
Patch Changes
-
#3040
18dc2b3e2Thanks @davidkpiano! - TheAnyStateandAnyStateMachinetypes are now available, which can be used to express any state and state machine, respectively:import type { AnyState, AnyStateMachine } from 'xstate'; // A function that takes in any state machine function visualizeMachine(machine: AnyStateMachine) { // (exercise left to reader) } function logState(state: AnyState) { // ... } -
#3042
e53396f08Thanks @suerta-git! - Added theAnyStateConfigtype, which represents anyStateConfig<...>:import type { AnyStateConfig } from 'xstate'; import { State } from 'xstate'; // Retrieving the state config from localStorage const stateConfig: AnyStateConfig = JSON.parse( localStorage.getItem('app-state') ); // Use State.create() to restore state from config object with correct type const previousState = State.create(stateConfig);
v4.30.0
Minor Changes
-
#2965
8b8f719c3Thanks @satyasinha! - All actions are now available in theactionsvariable when importing:import { actions } from 'xstate' -
#2892
02de3d44fThanks @davidkpiano! - Persisted state can now be easily restored to a state compatible with the machine without converting it to aStateinstance first:// Persisting a state someService.subscribe(state => { localStorage.setItem('some-state', JSON.stringify(state)); }); // Restoring a state const stateJson = localStorage.getItem('some-state'); // No need to convert `stateJson` object to a state! const someService = interpret(someMachine).start(stateJson);
Patch Changes
-
#3012
ab431dcb8Thanks @Andarist! - Fixed an issue with a reference to@types/nodebeing inserted into XState's compiled output. This could cause unexpected issues in projects expecting APIs likesetTimeoutto be typed with browser compatibility in mind. -
#3023
642e9f5b8Thanks @Andarist! - Fixed an issue with states created usingmachine.getInitialStatenot being "resolved" in full. This could cause some things, such asaftertransitions, not being executed correctly after starting an interpreter using such state. -
#2982
a39145580Thanks @Andarist! - Marked all phantom properties on theStateMachinetype as deprecated. This deprioritized them in IDEs so they don't popup as first suggestions during property access. -
#2992
22737adf2Thanks @Andarist, @mattpocock! - Fixed an issue withstate.contextbecominganyafterstate.matcheswhen typegen is used. -
#2981
edf60d67bThanks @Andarist! - Moved an internal@ts-ignoreto a JSDoc-style comment to fix consuming projects that do not useskipLibCheck. Regular inline and block comments are not preserved in the TypeScript's emit.
Configuration
📅 Schedule: Branch creation - "before 8:00 am on the first day of the month" in timezone Europe/Berlin, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
- [ ] If you want to rebase/retry this PR, click this checkbox.
This PR has been generated by Mend Renovate. View repository job log here.
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint
🚧 It seems like this PR has lint errors 🚧
I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint