xstate 4.27.0 → 4.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +227 -90
- package/README.md +5 -5
- package/dist/xstate.interpreter.js +1 -1
- package/dist/xstate.js +1 -1
- package/dist/xstate.web.js +2 -2
- package/es/Actor.d.ts +1 -2
- package/es/Actor.js +5 -5
- package/es/Machine.d.ts +5 -4
- package/es/State.d.ts +17 -14
- package/es/State.js +4 -4
- package/es/StateNode.d.ts +22 -17
- package/es/StateNode.js +33 -36
- package/es/actions.d.ts +3 -4
- package/es/actions.js +22 -3
- package/es/behaviors.d.ts +1 -1
- package/es/devTools.d.ts +3 -4
- package/es/each.d.ts +1 -1
- package/es/index.d.ts +10 -21
- package/es/index.js +11 -22
- package/es/interpreter.d.ts +34 -31
- package/es/interpreter.js +21 -13
- package/es/model.d.ts +2 -2
- package/es/model.types.d.ts +8 -9
- package/es/schema.d.ts +1 -0
- package/es/schema.js +2 -1
- package/es/scxml.d.ts +2 -2
- package/es/stateUtils.d.ts +6 -5
- package/es/typegenTypes.d.ts +121 -0
- package/es/types.d.ts +118 -57
- package/es/utils.d.ts +7 -2
- package/es/utils.js +9 -2
- package/lib/Actor.d.ts +1 -2
- package/lib/Actor.js +4 -4
- package/lib/Machine.d.ts +5 -4
- package/lib/State.d.ts +17 -14
- package/lib/State.js +4 -4
- package/lib/StateNode.d.ts +22 -17
- package/lib/StateNode.js +32 -35
- package/lib/actions.d.ts +3 -4
- package/lib/actions.js +20 -0
- package/lib/behaviors.d.ts +1 -1
- package/lib/devTools.d.ts +3 -4
- package/lib/each.d.ts +1 -1
- package/lib/index.d.ts +10 -21
- package/lib/index.js +15 -26
- package/lib/interpreter.d.ts +34 -31
- package/lib/interpreter.js +18 -10
- package/lib/model.d.ts +2 -2
- package/lib/model.types.d.ts +8 -9
- package/lib/schema.d.ts +1 -0
- package/lib/schema.js +2 -0
- package/lib/scxml.d.ts +2 -2
- package/lib/stateUtils.d.ts +6 -5
- package/lib/typegenTypes.d.ts +121 -0
- package/lib/typegenTypes.js +2 -0
- package/lib/types.d.ts +118 -57
- package/lib/utils.d.ts +7 -2
- package/lib/utils.js +10 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,147 @@
|
|
|
1
1
|
# xstate
|
|
2
2
|
|
|
3
|
+
## 4.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#2965](https://github.com/statelyai/xstate/pull/2965) [`8b8f719c3`](https://github.com/statelyai/xstate/commit/8b8f719c36ab2c09fcd11b529cc6c9c89a06ad2e) Thanks [@satyasinha](https://github.com/satyasinha)! - All actions are now available in the `actions` variable when importing: `import { actions } from 'xstate'`
|
|
8
|
+
|
|
9
|
+
* [#2892](https://github.com/statelyai/xstate/pull/2892) [`02de3d44f`](https://github.com/statelyai/xstate/commit/02de3d44f8ca87b4dcb4153d3560da7d43ee9d0b) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Persisted state can now be easily restored to a state compatible with the machine without converting it to a `State` instance first:
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
// Persisting a state
|
|
13
|
+
someService.subscribe(state => {
|
|
14
|
+
localStorage.setItem('some-state', JSON.stringify(state));
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// Restoring a state
|
|
18
|
+
const stateJson = localStorage.getItem('some-state');
|
|
19
|
+
|
|
20
|
+
// No need to convert `stateJson` object to a state!
|
|
21
|
+
const someService = interpret(someMachine).start(stateJson);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#3012](https://github.com/statelyai/xstate/pull/3012) [`ab431dcb8`](https://github.com/statelyai/xstate/commit/ab431dcb8bd67a3f0bcfc9b6ca31779bb15d14af) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with a reference to `@types/node` being inserted into XState's compiled output. This could cause unexpected issues in projects expecting APIs like `setTimeout` to be typed with browser compatibility in mind.
|
|
27
|
+
|
|
28
|
+
* [#3023](https://github.com/statelyai/xstate/pull/3023) [`642e9f5b8`](https://github.com/statelyai/xstate/commit/642e9f5b83dae79f016be8b657d25499077bbcda) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with states created using `machine.getInitialState` not being "resolved" in full. This could cause some things, such as `after` transitions, not being executed correctly after starting an interpreter using such state.
|
|
29
|
+
|
|
30
|
+
- [#2982](https://github.com/statelyai/xstate/pull/2982) [`a39145580`](https://github.com/statelyai/xstate/commit/a391455803171dcf03a1a0ec589f9dd603260d63) Thanks [@Andarist](https://github.com/Andarist)! - Marked all phantom properties on the `StateMachine` type as deprecated. This deprioritized them in IDEs so they don't popup as first suggestions during property access.
|
|
31
|
+
|
|
32
|
+
* [#2992](https://github.com/statelyai/xstate/pull/2992) [`22737adf2`](https://github.com/statelyai/xstate/commit/22737adf211971197f3809f406ac3bee54dc69f0) Thanks [@Andarist](https://github.com/Andarist), [@mattpocock](https://github.com/mattpocock)! - Fixed an issue with `state.context` becoming `any` after `state.matches` when typegen is used.
|
|
33
|
+
|
|
34
|
+
- [#2981](https://github.com/statelyai/xstate/pull/2981) [`edf60d67b`](https://github.com/statelyai/xstate/commit/edf60d67b3ca58eca96c7853410528c4e4abac7b) Thanks [@Andarist](https://github.com/Andarist)! - Moved an internal `@ts-ignore` to a JSDoc-style comment to fix consuming projects that do not use `skipLibCheck`. Regular inline and block comments are not preserved in the TypeScript's emit.
|
|
35
|
+
|
|
36
|
+
## 4.29.0
|
|
37
|
+
|
|
38
|
+
### Minor Changes
|
|
39
|
+
|
|
40
|
+
- [#2674](https://github.com/statelyai/xstate/pull/2674) [`1cd26811c`](https://github.com/statelyai/xstate/commit/1cd26811cea441366a082b0f77c7a6ffb135dc38) Thanks [@Andarist](https://github.com/Andarist)! - Using `config.schema` becomes the preferred way of "declaring" TypeScript generics with this release:
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
createMachine({
|
|
44
|
+
schema: {
|
|
45
|
+
context: {} as { count: number },
|
|
46
|
+
events: {} as { type: 'INC' } | { type: 'DEC' }
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This allows us to leverage the inference algorithm better and unlocks some exciting possibilities for using XState in a more type-strict manner.
|
|
52
|
+
|
|
53
|
+
* [#2674](https://github.com/statelyai/xstate/pull/2674) [`1cd26811c`](https://github.com/statelyai/xstate/commit/1cd26811cea441366a082b0f77c7a6ffb135dc38) Thanks [@Andarist](https://github.com/Andarist), [@mattpocock](https://github.com/mattpocock)! - Added the ability to tighten TS declarations of machine with generated metadata. This opens several exciting doors to being able to use typegen seamlessly with XState to provide an amazing typing experience.
|
|
54
|
+
|
|
55
|
+
With the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=statelyai.stately-vscode), you can specify a new attribute called `tsTypes: {}` in your machine definition:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
const machine = createMachine({
|
|
59
|
+
tsTypes: {}
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The extension will automatically add a type assertion to this property, which allows for type-safe access to a lot of XState's API's.
|
|
64
|
+
|
|
65
|
+
⚠️ This feature is in beta. Actions/services/guards/delays might currently get incorrectly annotated if they are called "in response" to always transitions or raised events. We are working on fixing this, both in XState and in the typegen.
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- [#2962](https://github.com/statelyai/xstate/pull/2962) [`32520650b`](https://github.com/statelyai/xstate/commit/32520650b7d6b43e416b896054033432aaede5d5) Thanks [@mattpocock](https://github.com/mattpocock)! - Added `t()`, which can be used to provide types for `schema` attributes in machine configs:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { t, createMachine } from 'xstate';
|
|
73
|
+
|
|
74
|
+
const machine = createMachine({
|
|
75
|
+
schema: {
|
|
76
|
+
context: t<{ value: number }>(),
|
|
77
|
+
events: t<{ type: 'EVENT_1' } | { type: 'EVENT_2' }>()
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
* [#2957](https://github.com/statelyai/xstate/pull/2957) [`8550ddda7`](https://github.com/statelyai/xstate/commit/8550ddda73e2ad291e19173d7fa8d13e3336fbb9) Thanks [@davidkpiano](https://github.com/davidkpiano)! - The repository links have been updated from `github.com/davidkpiano` to `github.com/statelyai`.
|
|
83
|
+
|
|
84
|
+
## 4.28.1
|
|
85
|
+
|
|
86
|
+
### Patch Changes
|
|
87
|
+
|
|
88
|
+
- [#2943](https://github.com/statelyai/xstate/pull/2943) [`e9f3f07a1`](https://github.com/statelyai/xstate/commit/e9f3f07a1ee9fe97af7e8f532c5b3dd3c4f73cec) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an infinite loop when initially spawned actor (in an initial context) responded synchronously to its parent.
|
|
89
|
+
|
|
90
|
+
* [#2953](https://github.com/statelyai/xstate/pull/2953) [`90fa97008`](https://github.com/statelyai/xstate/commit/90fa97008970283f17a3f2f6aa9b1b7071593e80) Thanks [@Andarist](https://github.com/Andarist)! - Bring back the global type declaration for the `Symbol.observable` to fix consuming projects that do not use `skipLibCheck`.
|
|
91
|
+
|
|
92
|
+
- [#2903](https://github.com/statelyai/xstate/pull/2903) [`b6dde9075`](https://github.com/statelyai/xstate/commit/b6dde9075adb3bb3522b4b8f8eeb804d3221a527) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with exit actions being called in random order when stopping a machine. They should always be called in the reversed document order (the ones defined on children should be called before the ones defined on ancestors and the ones defined on states appearing later in the code should be called before the ones defined on their sibling states).
|
|
93
|
+
|
|
94
|
+
## 4.28.0
|
|
95
|
+
|
|
96
|
+
### Minor Changes
|
|
97
|
+
|
|
98
|
+
- [#2835](https://github.com/statelyai/xstate/pull/2835) [`029f7b75a`](https://github.com/statelyai/xstate/commit/029f7b75a22a8186e5e3983dfd980c52369ef09f) Thanks [@woutermont](https://github.com/woutermont)! - Added interop observable symbols to `ActorRef` so that actor refs are compatible with libraries like RxJS.
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- [#2864](https://github.com/statelyai/xstate/pull/2864) [`4252ee212`](https://github.com/statelyai/xstate/commit/4252ee212e59fd074707b933c101662d47938849) Thanks [@davidkpiano](https://github.com/statelyai)! - Generated IDs for invocations that do not provide an `id` are now based on the state ID to avoid collisions:
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
createMachine({
|
|
106
|
+
id: 'test',
|
|
107
|
+
initial: 'p',
|
|
108
|
+
states: {
|
|
109
|
+
p: {
|
|
110
|
+
type: 'parallel',
|
|
111
|
+
states: {
|
|
112
|
+
// Before this change, both invoke IDs would be 'someSource',
|
|
113
|
+
// which is incorrect.
|
|
114
|
+
a: {
|
|
115
|
+
invoke: {
|
|
116
|
+
src: 'someSource'
|
|
117
|
+
// generated invoke ID: 'test.p.a:invocation[0]'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
b: {
|
|
121
|
+
invoke: {
|
|
122
|
+
src: 'someSource'
|
|
123
|
+
// generated invoke ID: 'test.p.b:invocation[0]'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
* [#2925](https://github.com/statelyai/xstate/pull/2925) [`239b4666a`](https://github.com/statelyai/xstate/commit/239b4666ac302d80c028fef47c6e8ab7e0ae2757) Thanks [@devanfarrell](https://github.com/devanfarrell)! - The `sendTo(actorRef, event)` action creator introduced in `4.27.0`, which was not accessible from the package exports, can now be used just like other actions:
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
import { actions } from 'xstate';
|
|
136
|
+
|
|
137
|
+
const { sendTo } = actions;
|
|
138
|
+
```
|
|
139
|
+
|
|
3
140
|
## 4.27.0
|
|
4
141
|
|
|
5
142
|
### Minor Changes
|
|
6
143
|
|
|
7
|
-
- [#2800](https://github.com/statelyai/xstate/pull/2800) [`759a90155`](https://github.com/statelyai/xstate/commit/759a9015512bbf532d7044afe6a889c04dc7edf6) Thanks [@davidkpiano](https://github.com/
|
|
144
|
+
- [#2800](https://github.com/statelyai/xstate/pull/2800) [`759a90155`](https://github.com/statelyai/xstate/commit/759a9015512bbf532d7044afe6a889c04dc7edf6) Thanks [@davidkpiano](https://github.com/statelyai)! - The `sendTo(actorRef, event)` action creator has been introduced. It allows you to specify the recipient actor ref of an event first, so that the event can be strongly typed against the events allowed to be received by the actor ref:
|
|
8
145
|
|
|
9
146
|
```ts
|
|
10
147
|
// ...
|
|
@@ -17,7 +154,7 @@
|
|
|
17
154
|
|
|
18
155
|
### Patch Changes
|
|
19
156
|
|
|
20
|
-
- [#2804](https://github.com/statelyai/xstate/pull/2804) [`f3caecf5a`](https://github.com/statelyai/xstate/commit/f3caecf5ad384cfe2a843c26333aaa46a77ece68) Thanks [@davidkpiano](https://github.com/
|
|
157
|
+
- [#2804](https://github.com/statelyai/xstate/pull/2804) [`f3caecf5a`](https://github.com/statelyai/xstate/commit/f3caecf5ad384cfe2a843c26333aaa46a77ece68) Thanks [@davidkpiano](https://github.com/statelyai)! - The `state.can(...)` method no longer unnecessarily executes `assign()` actions and instead determines if a given event will change the state by reading transition data before evaluating actions.
|
|
21
158
|
|
|
22
159
|
* [#2856](https://github.com/statelyai/xstate/pull/2856) [`49c2e9094`](https://github.com/statelyai/xstate/commit/49c2e90945d369e2dfb2e4fc376b3f46714dce09) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with stopped children sometimes starting their own child actors. This could happen when the child was stopped synchronously (for example by its parent) when transitioning to an invoking state.
|
|
23
160
|
|
|
@@ -29,13 +166,13 @@
|
|
|
29
166
|
|
|
30
167
|
- [#2819](https://github.com/statelyai/xstate/pull/2819) [`0d51d33cd`](https://github.com/statelyai/xstate/commit/0d51d33cd6dc6ab876a5554788300282d03fa5d1) Thanks [@simonihmig](https://github.com/simonihmig)! - Support `globalThis` in `getGlobal()` for better compatibility
|
|
31
168
|
|
|
32
|
-
* [#2828](https://github.com/statelyai/xstate/pull/2828) [`c0ef3e8`](https://github.com/statelyai/xstate/commit/c0ef3e882c688e6beefb196a3293ec71b65625e3) Thanks [@davidkpiano](https://github.com/
|
|
169
|
+
* [#2828](https://github.com/statelyai/xstate/pull/2828) [`c0ef3e8`](https://github.com/statelyai/xstate/commit/c0ef3e882c688e6beefb196a3293ec71b65625e3) Thanks [@davidkpiano](https://github.com/statelyai)! - XState is now compatible with TypeScript version 4.5.
|
|
33
170
|
|
|
34
171
|
## 4.26.0
|
|
35
172
|
|
|
36
173
|
### Minor Changes
|
|
37
174
|
|
|
38
|
-
- [#2672](https://github.com/statelyai/xstate/pull/2672) [`8e1d05d`](https://github.com/statelyai/xstate/commit/8e1d05dcafab0d1c8a63b07694b3f208850b0b4b) Thanks [@davidkpiano](https://github.com/
|
|
175
|
+
- [#2672](https://github.com/statelyai/xstate/pull/2672) [`8e1d05d`](https://github.com/statelyai/xstate/commit/8e1d05dcafab0d1c8a63b07694b3f208850b0b4b) Thanks [@davidkpiano](https://github.com/statelyai)! - The `description` property is a new top-level property for state nodes and transitions, that lets you provide text descriptions:
|
|
39
176
|
|
|
40
177
|
```ts
|
|
41
178
|
const machine = createMachine({
|
|
@@ -65,7 +202,7 @@
|
|
|
65
202
|
|
|
66
203
|
### Patch Changes
|
|
67
204
|
|
|
68
|
-
- [#2738](https://github.com/statelyai/xstate/pull/2738) [`942fd90e0`](https://github.com/statelyai/xstate/commit/942fd90e0c7a942564dd9c2ffebb93d6c86698df) Thanks [@michelsciortino](https://github.com/michelsciortino)! - The `tags` property was missing from state's definitions. This is used when converting a state to a JSON string. Since this is how we serialize states within [`@xstate/inspect`](https://github.com/
|
|
205
|
+
- [#2738](https://github.com/statelyai/xstate/pull/2738) [`942fd90e0`](https://github.com/statelyai/xstate/commit/942fd90e0c7a942564dd9c2ffebb93d6c86698df) Thanks [@michelsciortino](https://github.com/michelsciortino)! - The `tags` property was missing from state's definitions. This is used when converting a state to a JSON string. Since this is how we serialize states within [`@xstate/inspect`](https://github.com/statelyai/xstate/tree/main/packages/xstate-inspect) this has caused inspected machines to miss the `tags` information.
|
|
69
206
|
|
|
70
207
|
* [#2740](https://github.com/statelyai/xstate/pull/2740) [`707cb981f`](https://github.com/statelyai/xstate/commit/707cb981fdb8a5c75cacb7e9bfa5c7e5a1cc1c88) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with tags being missed on a service state after starting that service using a state value, like this:
|
|
71
208
|
|
|
@@ -74,7 +211,7 @@
|
|
|
74
211
|
service.state.hasTag('foo'); // this should now return a correct result
|
|
75
212
|
```
|
|
76
213
|
|
|
77
|
-
- [#2691](https://github.com/statelyai/xstate/pull/2691) [`a72806035`](https://github.com/statelyai/xstate/commit/a728060353c9cb9bdb0cd37aacf793498a8750c8) Thanks [@davidkpiano](https://github.com/
|
|
214
|
+
- [#2691](https://github.com/statelyai/xstate/pull/2691) [`a72806035`](https://github.com/statelyai/xstate/commit/a728060353c9cb9bdb0cd37aacf793498a8750c8) Thanks [@davidkpiano](https://github.com/statelyai)! - Meta data can now be specified for `invoke` configs in the `invoke.meta` property:
|
|
78
215
|
|
|
79
216
|
```js
|
|
80
217
|
const machine = createMachine({
|
|
@@ -147,7 +284,7 @@
|
|
|
147
284
|
|
|
148
285
|
### Minor Changes
|
|
149
286
|
|
|
150
|
-
- [#2546](https://github.com/statelyai/xstate/pull/2546) [`a4cfce18c`](https://github.com/statelyai/xstate/commit/a4cfce18c0c179faef15adf25a75b08903064e28) Thanks [@davidkpiano](https://github.com/
|
|
287
|
+
- [#2546](https://github.com/statelyai/xstate/pull/2546) [`a4cfce18c`](https://github.com/statelyai/xstate/commit/a4cfce18c0c179faef15adf25a75b08903064e28) Thanks [@davidkpiano](https://github.com/statelyai)! - You can now know if an event will cause a state change by using the new `state.can(event)` method, which will return `true` if an interpreted machine will "change" the state when sent the `event`, or `false` otherwise:
|
|
151
288
|
|
|
152
289
|
```js
|
|
153
290
|
const machine = createMachine({
|
|
@@ -188,7 +325,7 @@
|
|
|
188
325
|
|
|
189
326
|
### Patch Changes
|
|
190
327
|
|
|
191
|
-
- [#2632](https://github.com/statelyai/xstate/pull/2632) [`f8cf5dfe0`](https://github.com/statelyai/xstate/commit/f8cf5dfe0bf20c8545208ed7b1ade619933004f9) Thanks [@davidkpiano](https://github.com/
|
|
328
|
+
- [#2632](https://github.com/statelyai/xstate/pull/2632) [`f8cf5dfe0`](https://github.com/statelyai/xstate/commit/f8cf5dfe0bf20c8545208ed7b1ade619933004f9) Thanks [@davidkpiano](https://github.com/statelyai)! - A regression was fixed where actions were being typed as `never` if events were specified in `createModel(...)` but not actions:
|
|
192
329
|
|
|
193
330
|
```ts
|
|
194
331
|
const model = createModel(
|
|
@@ -209,7 +346,7 @@
|
|
|
209
346
|
|
|
210
347
|
### Patch Changes
|
|
211
348
|
|
|
212
|
-
- [#2606](https://github.com/statelyai/xstate/pull/2606) [`01e5d7984`](https://github.com/statelyai/xstate/commit/01e5d7984a5441a6980eacdb06d42c2a9398bdff) Thanks [@davidkpiano](https://github.com/
|
|
349
|
+
- [#2606](https://github.com/statelyai/xstate/pull/2606) [`01e5d7984`](https://github.com/statelyai/xstate/commit/01e5d7984a5441a6980eacdb06d42c2a9398bdff) Thanks [@davidkpiano](https://github.com/statelyai)! - The following utility types were previously returning `never` in some unexpected cases, and are now working as expected:
|
|
213
350
|
|
|
214
351
|
- `ContextFrom<T>`
|
|
215
352
|
- `EventFrom<T>`
|
|
@@ -248,9 +385,9 @@
|
|
|
248
385
|
type Interpreter = InterpreterFrom<ReturnType<typeof machine>>;
|
|
249
386
|
```
|
|
250
387
|
|
|
251
|
-
* [`413a4578`](https://github.com/statelyai/xstate/commit/413a4578cded21beffff822d1485a3725457b768) [#2491](https://github.com/statelyai/xstate/pull/2491) Thanks [@davidkpiano](https://github.com/
|
|
388
|
+
* [`413a4578`](https://github.com/statelyai/xstate/commit/413a4578cded21beffff822d1485a3725457b768) [#2491](https://github.com/statelyai/xstate/pull/2491) Thanks [@davidkpiano](https://github.com/statelyai)! - The custom `.toString()` method on action objects is now removed which improves performance in larger applications (see [#2488](https://github.com/statelyai/xstate/discussions/2488) for more context).
|
|
252
389
|
|
|
253
|
-
- [`5e1223cd`](https://github.com/statelyai/xstate/commit/5e1223cd58485045b192677753946df2c00eddf7) [#2422](https://github.com/statelyai/xstate/pull/2422) Thanks [@davidkpiano](https://github.com/
|
|
390
|
+
- [`5e1223cd`](https://github.com/statelyai/xstate/commit/5e1223cd58485045b192677753946df2c00eddf7) [#2422](https://github.com/statelyai/xstate/pull/2422) Thanks [@davidkpiano](https://github.com/statelyai)! - The `context` property has been removed from `StateNodeConfig`, as it has never been allowed, nor has it ever done anything. The previous typing was unsafe and allowed `context` to be specified on nested state nodes:
|
|
254
391
|
|
|
255
392
|
```ts
|
|
256
393
|
createMachine({
|
|
@@ -268,7 +405,7 @@
|
|
|
268
405
|
});
|
|
269
406
|
```
|
|
270
407
|
|
|
271
|
-
* [`5b70c2ff`](https://github.com/statelyai/xstate/commit/5b70c2ff21cc5d8c6cf1c13b6eb7bb12611a9835) [#2508](https://github.com/statelyai/xstate/pull/2508) Thanks [@davidkpiano](https://github.com/
|
|
408
|
+
* [`5b70c2ff`](https://github.com/statelyai/xstate/commit/5b70c2ff21cc5d8c6cf1c13b6eb7bb12611a9835) [#2508](https://github.com/statelyai/xstate/pull/2508) Thanks [@davidkpiano](https://github.com/statelyai)! - A race condition occurred when a child service is immediately stopped and the parent service tried to remove it from its undefined state (during its own initialization). This has been fixed, and the race condition no longer occurs. See [this issue](https://github.com/statelyai/xstate/issues/2507) for details.
|
|
272
409
|
|
|
273
410
|
- [`5a9500d1`](https://github.com/statelyai/xstate/commit/5a9500d1cde9bf2300a85bc81529da83f2d08361) [#2522](https://github.com/statelyai/xstate/pull/2522) Thanks [@farskid](https://github.com/farskid), [@Andarist](https://github.com/Andarist)! - Adjusted TS type definitions of the `withContext` and `withConfig` methods so that they accept "lazy context" now.
|
|
274
411
|
|
|
@@ -301,7 +438,7 @@
|
|
|
301
438
|
|
|
302
439
|
### Minor Changes
|
|
303
440
|
|
|
304
|
-
- [`7dc7ceb8`](https://github.com/statelyai/xstate/commit/7dc7ceb8707569b48ceb35069125763a701a0a58) [#2379](https://github.com/statelyai/xstate/pull/2379) Thanks [@davidkpiano](https://github.com/
|
|
441
|
+
- [`7dc7ceb8`](https://github.com/statelyai/xstate/commit/7dc7ceb8707569b48ceb35069125763a701a0a58) [#2379](https://github.com/statelyai/xstate/pull/2379) Thanks [@davidkpiano](https://github.com/statelyai)! - There is a new `.preserveActionOrder` (default: `false`) setting in the machine configuration that preserves the order of actions when set to `true`. Normally, actions are executed in order _except_ for `assign(...)` actions, which are prioritized and executed first. When `.preserveActionOrder` is set to `true`, `assign(...)` actions will _not_ be prioritized, and will instead run in order. As a result, actions will capture the **intermediate `context` values** instead of the resulting `context` value from all `assign(...)` actions.
|
|
305
442
|
|
|
306
443
|
```ts
|
|
307
444
|
// With `.preserveActionOrder: true`
|
|
@@ -335,7 +472,7 @@
|
|
|
335
472
|
|
|
336
473
|
- [`4e305372`](https://github.com/statelyai/xstate/commit/4e30537266eb082ccd85f050c9372358247b4167) [#2361](https://github.com/statelyai/xstate/pull/2361) Thanks [@woutermont](https://github.com/woutermont)! - Add type for `Symbol.observable` to the `Interpreter` to improve the compatibility with RxJS.
|
|
337
474
|
|
|
338
|
-
* [`1def6cf6`](https://github.com/statelyai/xstate/commit/1def6cf6109867a87b4323ee83d20a9ee0c49d7b) [#2374](https://github.com/statelyai/xstate/pull/2374) Thanks [@davidkpiano](https://github.com/
|
|
475
|
+
* [`1def6cf6`](https://github.com/statelyai/xstate/commit/1def6cf6109867a87b4323ee83d20a9ee0c49d7b) [#2374](https://github.com/statelyai/xstate/pull/2374) Thanks [@davidkpiano](https://github.com/statelyai)! - Existing actors can now be identified in `spawn(...)` calls by providing an `id`. This allows them to be referenced by string:
|
|
339
476
|
|
|
340
477
|
```ts
|
|
341
478
|
const machine = createMachine({
|
|
@@ -350,7 +487,7 @@
|
|
|
350
487
|
});
|
|
351
488
|
```
|
|
352
489
|
|
|
353
|
-
- [`da6861e3`](https://github.com/statelyai/xstate/commit/da6861e34a2b28bf6eeaa7c04a2d4cf9a90f93f1) [#2391](https://github.com/statelyai/xstate/pull/2391) Thanks [@davidkpiano](https://github.com/
|
|
490
|
+
- [`da6861e3`](https://github.com/statelyai/xstate/commit/da6861e34a2b28bf6eeaa7c04a2d4cf9a90f93f1) [#2391](https://github.com/statelyai/xstate/pull/2391) Thanks [@davidkpiano](https://github.com/statelyai)! - There are two new helper types for extracting `context` and `event` types:
|
|
354
491
|
|
|
355
492
|
- `ContextFrom<T>` which extracts the `context` from any type that uses context
|
|
356
493
|
- `EventFrom<T>` which extracts the `event` type (which extends `EventObject`) from any type which uses events
|
|
@@ -359,7 +496,7 @@
|
|
|
359
496
|
|
|
360
497
|
### Minor Changes
|
|
361
498
|
|
|
362
|
-
- [`1b32aa0d`](https://github.com/statelyai/xstate/commit/1b32aa0d3a0eca11ffcb7ec9d710eb8828107aa0) [#2356](https://github.com/statelyai/xstate/pull/2356) Thanks [@davidkpiano](https://github.com/
|
|
499
|
+
- [`1b32aa0d`](https://github.com/statelyai/xstate/commit/1b32aa0d3a0eca11ffcb7ec9d710eb8828107aa0) [#2356](https://github.com/statelyai/xstate/pull/2356) Thanks [@davidkpiano](https://github.com/statelyai)! - The model created from `createModel(...)` now provides a `.createMachine(...)` method that does not require passing any generic type parameters:
|
|
363
500
|
|
|
364
501
|
```diff
|
|
365
502
|
const model = createModel(/* ... */);
|
|
@@ -368,7 +505,7 @@
|
|
|
368
505
|
+const machine = model.createMachine(/* ... */);
|
|
369
506
|
```
|
|
370
507
|
|
|
371
|
-
* [`432b60f7`](https://github.com/statelyai/xstate/commit/432b60f7bcbcee9510e0d86311abbfd75b1a674e) [#2280](https://github.com/statelyai/xstate/pull/2280) Thanks [@davidkpiano](https://github.com/
|
|
508
|
+
* [`432b60f7`](https://github.com/statelyai/xstate/commit/432b60f7bcbcee9510e0d86311abbfd75b1a674e) [#2280](https://github.com/statelyai/xstate/pull/2280) Thanks [@davidkpiano](https://github.com/statelyai)! - Actors can now be invoked/spawned from reducers using the `fromReducer(...)` behavior creator:
|
|
372
509
|
|
|
373
510
|
```ts
|
|
374
511
|
import { fromReducer } from 'xstate/lib/behaviors';
|
|
@@ -401,7 +538,7 @@
|
|
|
401
538
|
});
|
|
402
539
|
```
|
|
403
540
|
|
|
404
|
-
- [`f9bcea2c`](https://github.com/
|
|
541
|
+
- [`f9bcea2c`](https://github.com/statelyai/xstate/commit/f9bcea2ce909ac59fcb165b352a7b51a8b29a56d) [#2366](https://github.com/statelyai/xstate/pull/2366) Thanks [@davidkpiano](https://github.com/statelyai)! - Actors can now be spawned directly in the initial `machine.context` using lazy initialization, avoiding the need for intermediate states and unsafe typings for immediately spawned actors:
|
|
405
542
|
|
|
406
543
|
```ts
|
|
407
544
|
const machine = createMachine<{ ref: ActorRef<SomeEvent> }>({
|
|
@@ -416,13 +553,13 @@
|
|
|
416
553
|
|
|
417
554
|
### Patch Changes
|
|
418
555
|
|
|
419
|
-
- [`1ef29e83`](https://github.com/
|
|
556
|
+
- [`1ef29e83`](https://github.com/statelyai/xstate/commit/1ef29e83e14331083279d50fd3a8907eb63793eb) [#2343](https://github.com/statelyai/xstate/pull/2343) Thanks [@davidkpiano](https://github.com/statelyai)! - Eventless ("always") transitions will no longer be ignored if an event is sent to a machine in a state that does not have any enabled transitions for that event.
|
|
420
557
|
|
|
421
558
|
## 4.20.1
|
|
422
559
|
|
|
423
560
|
### Patch Changes
|
|
424
561
|
|
|
425
|
-
- [`99bc5fb9`](https://github.com/
|
|
562
|
+
- [`99bc5fb9`](https://github.com/statelyai/xstate/commit/99bc5fb9d1d7be35f4c767dcbbf5287755b306d0) [#2275](https://github.com/statelyai/xstate/pull/2275) Thanks [@davidkpiano](https://github.com/statelyai)! - The `SpawnedActorRef` TypeScript interface has been deprecated in favor of a unified `ActorRef` interface, which contains the following:
|
|
426
563
|
|
|
427
564
|
```ts
|
|
428
565
|
interface ActorRef<TEvent extends EventObject, TEmitted = any>
|
|
@@ -447,7 +584,7 @@
|
|
|
447
584
|
}
|
|
448
585
|
```
|
|
449
586
|
|
|
450
|
-
* [`38e6a5e9`](https://github.com/
|
|
587
|
+
* [`38e6a5e9`](https://github.com/statelyai/xstate/commit/38e6a5e98a1dd54b4f2ef96942180ec0add88f2b) [#2334](https://github.com/statelyai/xstate/pull/2334) Thanks [@davidkpiano](https://github.com/statelyai)! - When using a model type in `createMachine<typeof someModel>(...)`, TypeScript will no longer compile machines that are missing the `context` property in the machine configuration:
|
|
451
588
|
|
|
452
589
|
```ts
|
|
453
590
|
const machine = createMachine<typeof someModel>({
|
|
@@ -460,7 +597,7 @@
|
|
|
460
597
|
});
|
|
461
598
|
```
|
|
462
599
|
|
|
463
|
-
- [`5f790ba5`](https://github.com/
|
|
600
|
+
- [`5f790ba5`](https://github.com/statelyai/xstate/commit/5f790ba5478cb733a59e3b0603e8976c11bcdd04) [#2320](https://github.com/statelyai/xstate/pull/2320) Thanks [@davidkpiano](https://github.com/statelyai)! - The typing for `InvokeCallback` have been improved for better event constraints when using the `sendBack` parameter of invoked callbacks:
|
|
464
601
|
|
|
465
602
|
```ts
|
|
466
603
|
invoke: () => (sendBack, receive) => {
|
|
@@ -469,7 +606,7 @@
|
|
|
469
606
|
};
|
|
470
607
|
```
|
|
471
608
|
|
|
472
|
-
* [`2de3ec3e`](https://github.com/
|
|
609
|
+
* [`2de3ec3e`](https://github.com/statelyai/xstate/commit/2de3ec3e994e0deb5a142aeac15e1eddeb18d1e1) [#2272](https://github.com/statelyai/xstate/pull/2272) Thanks [@davidkpiano](https://github.com/statelyai)! - The `state.meta` value is now calculated directly from `state.configuration`. This is most useful when starting a service from a persisted state:
|
|
473
610
|
|
|
474
611
|
```ts
|
|
475
612
|
const machine = createMachine({
|
|
@@ -506,7 +643,7 @@
|
|
|
506
643
|
|
|
507
644
|
### Minor Changes
|
|
508
645
|
|
|
509
|
-
- [`28059b9f`](https://github.com/
|
|
646
|
+
- [`28059b9f`](https://github.com/statelyai/xstate/commit/28059b9f09926d683d80b7d816f5b703c0667a9f) [#2197](https://github.com/statelyai/xstate/pull/2197) Thanks [@davidkpiano](https://github.com/statelyai)! - All spawned and invoked actors now have a `.getSnapshot()` method, which allows you to retrieve the latest value emitted from that actor. That value may be `undefined` if no value has been emitted yet.
|
|
510
647
|
|
|
511
648
|
```js
|
|
512
649
|
const machine = createMachine({
|
|
@@ -537,31 +674,31 @@
|
|
|
537
674
|
|
|
538
675
|
### Patch Changes
|
|
539
676
|
|
|
540
|
-
- [`4ef03465`](https://github.com/
|
|
677
|
+
- [`4ef03465`](https://github.com/statelyai/xstate/commit/4ef03465869e27dc878ec600661c9253d90f74f0) [#2240](https://github.com/statelyai/xstate/pull/2240) Thanks [@VanTanev](https://github.com/VanTanev)! - Preserve StateMachine type when .withConfig() and .withContext() modifiers are used on a machine.
|
|
541
678
|
|
|
542
679
|
## 4.19.2
|
|
543
680
|
|
|
544
681
|
### Patch Changes
|
|
545
682
|
|
|
546
|
-
- [`18789aa9`](https://github.com/
|
|
683
|
+
- [`18789aa9`](https://github.com/statelyai/xstate/commit/18789aa94669e48b71e2ae22e524d9bbe9dbfc63) [#2107](https://github.com/statelyai/xstate/pull/2107) Thanks [@woutermont](https://github.com/woutermont)! - This update restricts invoked `Subscribable`s to `EventObject`s,
|
|
547
684
|
so that type inference can be done on which `Subscribable`s are
|
|
548
685
|
allowed to be invoked. Existing `MachineConfig`s that invoke
|
|
549
686
|
`Subscribable<any>`s that are not `Subscribable<EventObject>`s
|
|
550
687
|
should be updated accordingly.
|
|
551
688
|
|
|
552
|
-
* [`38dcec1d`](https://github.com/
|
|
689
|
+
* [`38dcec1d`](https://github.com/statelyai/xstate/commit/38dcec1dad60c62cf8c47c88736651483276ff87) [#2149](https://github.com/statelyai/xstate/pull/2149) Thanks [@davidkpiano](https://github.com/statelyai)! - Invocations and entry actions for _combinatorial_ machines (machines with only a single root state) now behave predictably and will not re-execute upon targetless transitions.
|
|
553
690
|
|
|
554
691
|
## 4.19.1
|
|
555
692
|
|
|
556
693
|
### Patch Changes
|
|
557
694
|
|
|
558
|
-
- [`64ab1150`](https://github.com/
|
|
695
|
+
- [`64ab1150`](https://github.com/statelyai/xstate/commit/64ab1150e0a383202f4af1d586b28e081009c929) [#2173](https://github.com/statelyai/xstate/pull/2173) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with tags not being set correctly after sending an event to a machine that didn't result in selecting any transitions.
|
|
559
696
|
|
|
560
697
|
## 4.19.0
|
|
561
698
|
|
|
562
699
|
### Minor Changes
|
|
563
700
|
|
|
564
|
-
- [`4f2f626d`](https://github.com/
|
|
701
|
+
- [`4f2f626d`](https://github.com/statelyai/xstate/commit/4f2f626dc84f45bb18ded6dd9aad3b6f6a2190b1) [#2143](https://github.com/statelyai/xstate/pull/2143) Thanks [@davidkpiano](https://github.com/statelyai)! - Tags can now be added to state node configs under the `.tags` property:
|
|
565
702
|
|
|
566
703
|
```js
|
|
567
704
|
const machine = createMachine({
|
|
@@ -589,15 +726,15 @@
|
|
|
589
726
|
|
|
590
727
|
### Patch Changes
|
|
591
728
|
|
|
592
|
-
- [`a61d01ce`](https://github.com/
|
|
729
|
+
- [`a61d01ce`](https://github.com/statelyai/xstate/commit/a61d01cefab5734adf9bfb167291f5b0ba712684) [#2125](https://github.com/statelyai/xstate/pull/2125) Thanks [@VanTanev](https://github.com/VanTanev)! - In callback invokes, the types of `callback` and `onReceive` are properly scoped to the machine TEvent.
|
|
593
730
|
|
|
594
731
|
## 4.18.0
|
|
595
732
|
|
|
596
733
|
### Minor Changes
|
|
597
734
|
|
|
598
|
-
- [`d0939ec6`](https://github.com/
|
|
735
|
+
- [`d0939ec6`](https://github.com/statelyai/xstate/commit/d0939ec60161c34b053cecdaeb277606b5982375) [#2046](https://github.com/statelyai/xstate/pull/2046) Thanks [@SimeonC](https://github.com/SimeonC)! - Allow machines to communicate with the inspector even in production builds.
|
|
599
736
|
|
|
600
|
-
* [`e37fffef`](https://github.com/
|
|
737
|
+
* [`e37fffef`](https://github.com/statelyai/xstate/commit/e37fffefb742f45765945c02727edfbd5e2f9d47) [#2079](https://github.com/statelyai/xstate/pull/2079) Thanks [@davidkpiano](https://github.com/statelyai)! - There is now support for "combinatorial machines" (state machines that only have one state):
|
|
601
738
|
|
|
602
739
|
```js
|
|
603
740
|
const testMachine = createMachine({
|
|
@@ -614,19 +751,19 @@
|
|
|
614
751
|
|
|
615
752
|
### Patch Changes
|
|
616
753
|
|
|
617
|
-
- [`6a9247d4`](https://github.com/
|
|
754
|
+
- [`6a9247d4`](https://github.com/statelyai/xstate/commit/6a9247d4d3a39e6c8c4724d3368a13fcdef10907) [#2102](https://github.com/statelyai/xstate/pull/2102) Thanks [@VanTanev](https://github.com/VanTanev)! - Provide a convenience type for getting the `Interpreter` type based on the `StateMachine` type by transferring all generic parameters onto it. It can be used like this: `InterpreterFrom<typeof machine>`
|
|
618
755
|
|
|
619
756
|
## 4.17.1
|
|
620
757
|
|
|
621
758
|
### Patch Changes
|
|
622
759
|
|
|
623
|
-
- [`33302814`](https://github.com/
|
|
760
|
+
- [`33302814`](https://github.com/statelyai/xstate/commit/33302814c38587d0044afd2ae61a4ff4779416c6) [#2041](https://github.com/statelyai/xstate/pull/2041) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with creatorless models not being correctly matched by `createMachine`'s overload responsible for using model-induced types.
|
|
624
761
|
|
|
625
762
|
## 4.17.0
|
|
626
763
|
|
|
627
764
|
### Minor Changes
|
|
628
765
|
|
|
629
|
-
- [`7763db8d`](https://github.com/
|
|
766
|
+
- [`7763db8d`](https://github.com/statelyai/xstate/commit/7763db8d3615321d03839b2bd31c9b118ddee50c) [#1977](https://github.com/statelyai/xstate/pull/1977) Thanks [@davidkpiano](https://github.com/statelyai)! - The `schema` property has been introduced to the machine config passed into `createMachine(machineConfig)`, which allows you to provide metadata for the following:
|
|
630
767
|
|
|
631
768
|
- Context
|
|
632
769
|
- Events
|
|
@@ -678,7 +815,7 @@
|
|
|
678
815
|
});
|
|
679
816
|
```
|
|
680
817
|
|
|
681
|
-
* [`5febfe83`](https://github.com/
|
|
818
|
+
* [`5febfe83`](https://github.com/statelyai/xstate/commit/5febfe83a7e5e866c0a4523ea4f86a966af7c50f) [#1955](https://github.com/statelyai/xstate/pull/1955) Thanks [@davidkpiano](https://github.com/statelyai)! - Event creators can now be modeled inside of the 2nd argument of `createModel()`, and types for both `context` and `events` will be inferred properly in `createMachine()` when given the `typeof model` as the first generic parameter.
|
|
682
819
|
|
|
683
820
|
```ts
|
|
684
821
|
import { createModel } from 'xstate/lib/model';
|
|
@@ -726,25 +863,25 @@
|
|
|
726
863
|
|
|
727
864
|
### Patch Changes
|
|
728
865
|
|
|
729
|
-
- [`4194ffe8`](https://github.com/
|
|
866
|
+
- [`4194ffe8`](https://github.com/statelyai/xstate/commit/4194ffe84cfe7910e2c183701e36bc5cac5c9bcc) [#1710](https://github.com/statelyai/xstate/pull/1710) Thanks [@davidkpiano](https://github.com/statelyai)! - Stopping an already stopped interpreter will no longer crash. See [#1697](https://github.com/statelyai/xstate/issues/1697) for details.
|
|
730
867
|
|
|
731
868
|
## 4.16.1
|
|
732
869
|
|
|
733
870
|
### Patch Changes
|
|
734
871
|
|
|
735
|
-
- [`af6b7c70`](https://github.com/
|
|
872
|
+
- [`af6b7c70`](https://github.com/statelyai/xstate/commit/af6b7c70015db29d84f79dfd29ea0dc221b8f3e6) [#1865](https://github.com/statelyai/xstate/pull/1865) Thanks [@Andarist](https://github.com/Andarist)! - Improved `.matches(value)` inference for typestates containing union types as values.
|
|
736
873
|
|
|
737
874
|
## 4.16.0
|
|
738
875
|
|
|
739
876
|
### Minor Changes
|
|
740
877
|
|
|
741
|
-
- [`d2e328f8`](https://github.com/
|
|
878
|
+
- [`d2e328f8`](https://github.com/statelyai/xstate/commit/d2e328f8efad7e8d3500d39976d1153a26e835a3) [#1439](https://github.com/statelyai/xstate/pull/1439) Thanks [@davidkpiano](https://github.com/statelyai)! - An opt-in `createModel()` helper has been introduced to make it easier to work with typed `context` and events.
|
|
742
879
|
|
|
743
880
|
- `createModel(initialContext)` creates a `model` object
|
|
744
881
|
- `model.initialContext` returns the `initialContext`
|
|
745
882
|
- `model.assign(assigner, event?)` creates an `assign` action that is properly scoped to the `event` in TypeScript
|
|
746
883
|
|
|
747
|
-
See https://github.com/
|
|
884
|
+
See https://github.com/statelyai/xstate/pull/1439 for more details.
|
|
748
885
|
|
|
749
886
|
```js
|
|
750
887
|
import { createMachine } from 'xstate';
|
|
@@ -787,31 +924,31 @@
|
|
|
787
924
|
|
|
788
925
|
### Patch Changes
|
|
789
926
|
|
|
790
|
-
- [`0cb8df9b`](https://github.com/
|
|
927
|
+
- [`0cb8df9b`](https://github.com/statelyai/xstate/commit/0cb8df9b6c8cd01ada82afe967bf1015e24e75d9) [#1816](https://github.com/statelyai/xstate/pull/1816) Thanks [@Andarist](https://github.com/Andarist)! - `machine.resolveState(state)` calls should resolve to the correct value of `.done` property now.
|
|
791
928
|
|
|
792
929
|
## 4.15.3
|
|
793
930
|
|
|
794
931
|
### Patch Changes
|
|
795
932
|
|
|
796
|
-
- [`63ba888e`](https://github.com/
|
|
933
|
+
- [`63ba888e`](https://github.com/statelyai/xstate/commit/63ba888e19bd2b72f9aad2c9cd36cde297e0ffe5) [#1770](https://github.com/statelyai/xstate/pull/1770) Thanks [@davidkpiano](https://github.com/statelyai)! - Instead of referencing `window` directly, XState now internally calls a `getGlobal()` function that will resolve to the proper `globalThis` value in all environments. This affects the dev tools code only.
|
|
797
934
|
|
|
798
935
|
## 4.15.2
|
|
799
936
|
|
|
800
937
|
### Patch Changes
|
|
801
938
|
|
|
802
|
-
- [`497c543d`](https://github.com/
|
|
939
|
+
- [`497c543d`](https://github.com/statelyai/xstate/commit/497c543d2980ea1a277b30b340a7bcd3dd0b3cb6) [#1766](https://github.com/statelyai/xstate/pull/1766) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with events received from callback actors not having the appropriate `_event.origin` set.
|
|
803
940
|
|
|
804
941
|
## 4.15.1
|
|
805
942
|
|
|
806
943
|
### Patch Changes
|
|
807
944
|
|
|
808
|
-
- [`8a8cfa32`](https://github.com/
|
|
945
|
+
- [`8a8cfa32`](https://github.com/statelyai/xstate/commit/8a8cfa32d99aedf11f4af93ba56fa9ba68925c74) [#1704](https://github.com/statelyai/xstate/pull/1704) Thanks [@blimmer](https://github.com/blimmer)! - The default `clock` methods (`setTimeout` and `clearTimeout`) are now invoked properly with the global context preserved for those invocations which matter for some JS environments. More details can be found in the corresponding issue: [#1703](https://github.com/statelyai/xstate/issues/1703).
|
|
809
946
|
|
|
810
947
|
## 4.15.0
|
|
811
948
|
|
|
812
949
|
### Minor Changes
|
|
813
950
|
|
|
814
|
-
- [`6596d0ba`](https://github.com/
|
|
951
|
+
- [`6596d0ba`](https://github.com/statelyai/xstate/commit/6596d0ba163341fc43d214b48115536cb4815b68) [#1622](https://github.com/statelyai/xstate/pull/1622) Thanks [@davidkpiano](https://github.com/statelyai)! - Spawned/invoked actors and interpreters are now typed as extending `ActorRef` (e.g., `SpawnedActorRef`) rather than `Actor` or `Interpreter`. This unification of types should make it more straightforward to provide actor types:
|
|
815
952
|
|
|
816
953
|
```diff
|
|
817
954
|
import {
|
|
@@ -848,19 +985,19 @@
|
|
|
848
985
|
|
|
849
986
|
### Patch Changes
|
|
850
987
|
|
|
851
|
-
- [`75a91b07`](https://github.com/
|
|
988
|
+
- [`75a91b07`](https://github.com/statelyai/xstate/commit/75a91b078a10a86f13edc9eec3ac1d6246607002) [#1692](https://github.com/statelyai/xstate/pull/1692) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with history state entering a wrong state if the most recent visit in its parent has been caused by a transient transition.
|
|
852
989
|
|
|
853
990
|
## 4.14.1
|
|
854
991
|
|
|
855
992
|
### Patch Changes
|
|
856
993
|
|
|
857
|
-
- [`02c76350`](https://github.com/
|
|
994
|
+
- [`02c76350`](https://github.com/statelyai/xstate/commit/02c763504da0808eeb281587981a5baf8ba884a1) [#1656](https://github.com/statelyai/xstate/pull/1656) Thanks [@Andarist](https://github.com/Andarist)! - Exit actions will now be properly called when a service gets canceled by calling its `stop` method.
|
|
858
995
|
|
|
859
996
|
## 4.14.0
|
|
860
997
|
|
|
861
998
|
### Minor Changes
|
|
862
999
|
|
|
863
|
-
- [`119db8fb`](https://github.com/
|
|
1000
|
+
- [`119db8fb`](https://github.com/statelyai/xstate/commit/119db8fbccd08f899e1275a502d8c4c51b5a130e) [#1577](https://github.com/statelyai/xstate/pull/1577) Thanks [@davidkpiano](https://github.com/statelyai)! - Expressions can now be used in the `stop()` action creator:
|
|
864
1001
|
|
|
865
1002
|
```js
|
|
866
1003
|
// ...
|
|
@@ -869,27 +1006,27 @@
|
|
|
869
1006
|
|
|
870
1007
|
### Patch Changes
|
|
871
1008
|
|
|
872
|
-
- [`8c78e120`](https://github.com/
|
|
1009
|
+
- [`8c78e120`](https://github.com/statelyai/xstate/commit/8c78e1205a729d933e30db01cd4260d82352a9be) [#1570](https://github.com/statelyai/xstate/pull/1570) Thanks [@davidkpiano](https://github.com/statelyai)! - The return type of `spawn(machine)` will now be `Actor<State<TContext, TEvent>, TEvent>`, which is a supertype of `Interpreter<...>`.
|
|
873
1010
|
|
|
874
|
-
* [`602687c2`](https://github.com/
|
|
1011
|
+
* [`602687c2`](https://github.com/statelyai/xstate/commit/602687c235c56cca552c2d5a9d78adf224f522d8) [#1566](https://github.com/statelyai/xstate/pull/1566) Thanks [@davidkpiano](https://github.com/statelyai)! - Exit actions will now be properly called when an invoked machine reaches its final state. See [#1109](https://github.com/statelyai/xstate/issues/1109) for more details.
|
|
875
1012
|
|
|
876
|
-
- [`6e44d02a`](https://github.com/
|
|
1013
|
+
- [`6e44d02a`](https://github.com/statelyai/xstate/commit/6e44d02ad03af4041046120dd6c975e3b5b3772a) [#1553](https://github.com/statelyai/xstate/pull/1553) Thanks [@davidkpiano](https://github.com/statelyai)! - The `state.children` property now properly shows all spawned and invoked actors. See [#795](https://github.com/statelyai/xstate/issues/795) for more details.
|
|
877
1014
|
|
|
878
|
-
* [`72b0880e`](https://github.com/
|
|
1015
|
+
* [`72b0880e`](https://github.com/statelyai/xstate/commit/72b0880e6444ae009adca72088872bb5c0760ce3) [#1504](https://github.com/statelyai/xstate/pull/1504) Thanks [@Andarist](https://github.com/Andarist)! - Added `status` property on the `Interpreter` - this can be used to differentiate not started, running and stopped interpreters. This property is best compared to values on the new `InterpreterStatus` export.
|
|
879
1016
|
|
|
880
1017
|
## 4.13.0
|
|
881
1018
|
|
|
882
1019
|
### Minor Changes
|
|
883
1020
|
|
|
884
|
-
- [`f51614df`](https://github.com/
|
|
1021
|
+
- [`f51614df`](https://github.com/statelyai/xstate/commit/f51614dff760cfe4511c0bc7cca3d022157c104c) [#1409](https://github.com/statelyai/xstate/pull/1409) Thanks [@jirutka](https://github.com/jirutka)! - Fix type `ExtractStateValue` so that it generates a type actually describing a `State.value`
|
|
885
1022
|
|
|
886
1023
|
### Patch Changes
|
|
887
1024
|
|
|
888
|
-
- [`b1684ead`](https://github.com/
|
|
1025
|
+
- [`b1684ead`](https://github.com/statelyai/xstate/commit/b1684eadb1f859db5c733b8d403afc825c294948) [#1402](https://github.com/statelyai/xstate/pull/1402) Thanks [@Andarist](https://github.com/Andarist)! - Improved TypeScript type-checking performance a little bit by using distributive conditional type within `TransitionsConfigArray` declarations instead of a mapped type. Kudos to [@amcasey](https://github.com/amcasey), some discussion around this can be found [here](https://github.com/microsoft/TypeScript/issues/39826#issuecomment-675790689)
|
|
889
1026
|
|
|
890
|
-
* [`ad3026d4`](https://github.com/
|
|
1027
|
+
* [`ad3026d4`](https://github.com/statelyai/xstate/commit/ad3026d4309e9a1c719e09fd8c15cdfefce22055) [#1407](https://github.com/statelyai/xstate/pull/1407) Thanks [@tomenden](https://github.com/tomenden)! - Fixed an issue with not being able to run XState in Web Workers due to assuming that `window` or `global` object is available in the executing environment, but none of those are actually available in the Web Workers context.
|
|
891
1028
|
|
|
892
|
-
- [`4e949ec8`](https://github.com/
|
|
1029
|
+
- [`4e949ec8`](https://github.com/statelyai/xstate/commit/4e949ec856349062352562c825beb0654e528f81) [#1401](https://github.com/statelyai/xstate/pull/1401) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with spawned actors being spawned multiple times when they got spawned in an initial state of a child machine that is invoked in the initial state of a parent machine.
|
|
893
1030
|
|
|
894
1031
|
<details>
|
|
895
1032
|
<summary>
|
|
@@ -933,9 +1070,9 @@
|
|
|
933
1070
|
|
|
934
1071
|
### Minor Changes
|
|
935
1072
|
|
|
936
|
-
- [`b72e29dd`](https://github.com/
|
|
1073
|
+
- [`b72e29dd`](https://github.com/statelyai/xstate/commit/b72e29dd728b4c1be4bdeaec93909b4e307db5cf) [#1354](https://github.com/statelyai/xstate/pull/1354) Thanks [@davidkpiano](https://github.com/statelyai)! - The `Action` type was simplified, and as a result, you should see better TypeScript performance.
|
|
937
1074
|
|
|
938
|
-
* [`4dbabfe7`](https://github.com/
|
|
1075
|
+
* [`4dbabfe7`](https://github.com/statelyai/xstate/commit/4dbabfe7d5ba154e852b4d460a2434c6fc955726) [#1320](https://github.com/statelyai/xstate/pull/1320) Thanks [@davidkpiano](https://github.com/statelyai)! - The `invoke.src` property now accepts an object that describes the invoke source with its `type` and other related metadata. This can be read from the `services` option in the `meta.src` argument:
|
|
939
1076
|
|
|
940
1077
|
```js
|
|
941
1078
|
const machine = createMachine(
|
|
@@ -967,13 +1104,13 @@
|
|
|
967
1104
|
|
|
968
1105
|
Specifying a string for `invoke.src` will continue to work the same; e.g., if `src: 'search'` was specified, this would be the same as `src: { type: 'search' }`.
|
|
969
1106
|
|
|
970
|
-
- [`8662e543`](https://github.com/
|
|
1107
|
+
- [`8662e543`](https://github.com/statelyai/xstate/commit/8662e543393de7e2f8a6d92ff847043781d10f4d) [#1317](https://github.com/statelyai/xstate/pull/1317) Thanks [@Andarist](https://github.com/Andarist)! - All `TTypestate` type parameters default to `{ value: any; context: TContext }` now and the parametrized type is passed correctly between various types which results in more accurate types involving typestates.
|
|
971
1108
|
|
|
972
1109
|
### Patch Changes
|
|
973
1110
|
|
|
974
|
-
- [`3ab3f25e`](https://github.com/
|
|
1111
|
+
- [`3ab3f25e`](https://github.com/statelyai/xstate/commit/3ab3f25ea297e4d770eef512e9583475c943845d) [#1285](https://github.com/statelyai/xstate/pull/1285) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with initial state of invoked machines being read without custom data passed to them which could lead to a crash when evaluating transient transitions for the initial state.
|
|
975
1112
|
|
|
976
|
-
* [`a7da1451`](https://github.com/
|
|
1113
|
+
* [`a7da1451`](https://github.com/statelyai/xstate/commit/a7da14510fd1645ad041836b567771edb5b90827) [#1290](https://github.com/statelyai/xstate/pull/1290) Thanks [@davidkpiano](https://github.com/statelyai)! - The "Attempted to spawn an Actor [...] outside of a service. This will have no effect." warnings are now silenced for "lazily spawned" actors, which are actors that aren't immediately active until the function that creates them are called:
|
|
977
1114
|
|
|
978
1115
|
```js
|
|
979
1116
|
// ⚠️ "active" actor - will warn
|
|
@@ -988,19 +1125,19 @@
|
|
|
988
1125
|
|
|
989
1126
|
It is recommended that all `spawn(...)`-ed actors are lazy, to avoid accidentally initializing them e.g., when reading `machine.initialState` or calculating otherwise pure transitions. In V5, this will be enforced.
|
|
990
1127
|
|
|
991
|
-
- [`c1f3d260`](https://github.com/
|
|
1128
|
+
- [`c1f3d260`](https://github.com/statelyai/xstate/commit/c1f3d26069ee70343f8045a48411e02a68f98cbd) [#1317](https://github.com/statelyai/xstate/pull/1317) Thanks [@Andarist](https://github.com/Andarist)! - Fixed a type returned by a `raise` action - it's now `RaiseAction<TEvent> | SendAction<TContext, AnyEventObject, TEvent>` instead of `RaiseAction<TEvent> | SendAction<TContext, TEvent, TEvent>`. This makes it comaptible in a broader range of scenarios.
|
|
992
1129
|
|
|
993
|
-
* [`8270d5a7`](https://github.com/
|
|
1130
|
+
* [`8270d5a7`](https://github.com/statelyai/xstate/commit/8270d5a76c71add3a5109e069bd85716b230b5d4) [#1372](https://github.com/statelyai/xstate/pull/1372) Thanks [@christianchown](https://github.com/christianchown)! - Narrowed the `ServiceConfig` type definition to use a specific event type to prevent compilation errors on strictly-typed `MachineOptions`.
|
|
994
1131
|
|
|
995
|
-
- [`01e3e2dc`](https://github.com/
|
|
1132
|
+
- [`01e3e2dc`](https://github.com/statelyai/xstate/commit/01e3e2dcead63dce3eef5ab745395584efbf05fa) [#1320](https://github.com/statelyai/xstate/pull/1320) Thanks [@davidkpiano](https://github.com/statelyai)! - The JSON definition for `stateNode.invoke` objects will no longer include the `onDone` and `onError` transitions, since those transitions are already merged into the `transitions` array. This solves the issue of reviving a serialized machine from JSON, where before, the `onDone` and `onError` transitions for invocations were wrongly duplicated.
|
|
996
1133
|
|
|
997
1134
|
## 4.11.0
|
|
998
1135
|
|
|
999
1136
|
### Minor Changes
|
|
1000
1137
|
|
|
1001
|
-
- [`36ed8d0a`](https://github.com/
|
|
1138
|
+
- [`36ed8d0a`](https://github.com/statelyai/xstate/commit/36ed8d0a3adf5b7fd187b0abe198220398e8b056) [#1262](https://github.com/statelyai/xstate/pull/1262) Thanks [@Andarist](https://github.com/Andarist)! - Improved type inference for `InvokeConfig['data']`. This has required renaming `data` property on `StateNode` instances to `doneData`. This property was never meant to be a part of the public API, so we don't consider this to be a breaking change.
|
|
1002
1139
|
|
|
1003
|
-
* [`2c75ab82`](https://github.com/
|
|
1140
|
+
* [`2c75ab82`](https://github.com/statelyai/xstate/commit/2c75ab822e49cb1a23c1e14eb7bd04548ab143eb) [#1219](https://github.com/statelyai/xstate/pull/1219) Thanks [@davidkpiano](https://github.com/statelyai)! - The resolved value of the `invoke.data` property is now available in the "invoke meta" object, which is passed as the 3rd argument to the service creator in `options.services`. This will work for all types of invoked services now, including promises, observables, and callbacks.
|
|
1004
1141
|
|
|
1005
1142
|
```js
|
|
1006
1143
|
const machine = createMachine({
|
|
@@ -1033,7 +1170,7 @@
|
|
|
1033
1170
|
}
|
|
1034
1171
|
```
|
|
1035
1172
|
|
|
1036
|
-
- [`a6c78ae9`](https://github.com/
|
|
1173
|
+
- [`a6c78ae9`](https://github.com/statelyai/xstate/commit/a6c78ae960acba36b61a41a5d154ea59908010b0) [#1249](https://github.com/statelyai/xstate/pull/1249) Thanks [@davidkpiano](https://github.com/statelyai)! - New property introduced for eventless (transient) transitions: **`always`**, which indicates a transition that is always taken when in that state. Empty string transition configs for [transient transitions](https://xstate.js.org/docs/guides/transitions.html#transient-transitions) are deprecated in favor of `always`:
|
|
1037
1174
|
|
|
1038
1175
|
```diff
|
|
1039
1176
|
// ...
|
|
@@ -1059,45 +1196,45 @@
|
|
|
1059
1196
|
|
|
1060
1197
|
### Patch Changes
|
|
1061
1198
|
|
|
1062
|
-
- [`36ed8d0a`](https://github.com/
|
|
1199
|
+
- [`36ed8d0a`](https://github.com/statelyai/xstate/commit/36ed8d0a3adf5b7fd187b0abe198220398e8b056) [#1262](https://github.com/statelyai/xstate/pull/1262) Thanks [@Andarist](https://github.com/Andarist)! - `StateMachine<any, any, any>` is no longer a part of the `InvokeConfig` type, but rather it creates a union with `InvokeConfig` in places where it is needed. This change shouldn't affect consumers' code.
|
|
1063
1200
|
|
|
1064
1201
|
## 4.10.0
|
|
1065
1202
|
|
|
1066
1203
|
### Minor Changes
|
|
1067
1204
|
|
|
1068
|
-
- [`0133954`](https://github.com/
|
|
1205
|
+
- [`0133954`](https://github.com/statelyai/xstate/commit/013395463b955e950ab24cb4be51faf524b0de6e) [#1178](https://github.com/statelyai/xstate/pull/1178) Thanks [@davidkpiano](https://github.com/statelyai)! - The types for the `send()` and `sendParent()` action creators have been changed to fix the issue of only being able to send events that the machine can receive. In reality, a machine can and should send events to other actors that it might not be able to receive itself. See [#711](https://github.com/statelyai/xstate/issues/711) for more information.
|
|
1069
1206
|
|
|
1070
|
-
* [`a1f1239`](https://github.com/
|
|
1207
|
+
* [`a1f1239`](https://github.com/statelyai/xstate/commit/a1f1239e20e05e338ed994d031e7ef6f2f09ad68) [#1189](https://github.com/statelyai/xstate/pull/1189) Thanks [@davidkpiano](https://github.com/statelyai)! - Previously, `state.matches(...)` was problematic because it was casting `state` to `never` if it didn't match the state value. This is now fixed by making the `Typestate` resolution more granular.
|
|
1071
1208
|
|
|
1072
|
-
- [`dbc6a16`](https://github.com/
|
|
1209
|
+
- [`dbc6a16`](https://github.com/statelyai/xstate/commit/dbc6a161c068a3e12dd12452b68a66fe3f4fb8eb) [#1183](https://github.com/statelyai/xstate/pull/1183) Thanks [@davidkpiano](https://github.com/statelyai)! - Actions from a restored state provided as a custom initial state to `interpret(machine).start(initialState)` are now executed properly. See #1174 for more information.
|
|
1073
1210
|
|
|
1074
1211
|
### Patch Changes
|
|
1075
1212
|
|
|
1076
|
-
- [`a10d604`](https://github.com/
|
|
1213
|
+
- [`a10d604`](https://github.com/statelyai/xstate/commit/a10d604a6afcf39048b02be5436acdd197f16c2b) [#1176](https://github.com/statelyai/xstate/pull/1176) Thanks [@itfarrier](https://github.com/itfarrier)! - Fix passing state schema into State generic
|
|
1077
1214
|
|
|
1078
|
-
* [`326db72`](https://github.com/
|
|
1215
|
+
* [`326db72`](https://github.com/statelyai/xstate/commit/326db725e50f7678af162626c6c7491e4364ec07) [#1185](https://github.com/statelyai/xstate/pull/1185) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with invoked service not being correctly started if other service got stopped in a subsequent microstep (in response to raised or null event).
|
|
1079
1216
|
|
|
1080
|
-
- [`c3a496e`](https://github.com/
|
|
1217
|
+
- [`c3a496e`](https://github.com/statelyai/xstate/commit/c3a496e1f92ec27db0643fd1ddc32d683db4e751) [#1160](https://github.com/statelyai/xstate/pull/1160) Thanks [@davidkpiano](https://github.com/statelyai)! - Delayed transitions defined using `after` were previously causing a circular dependency when the machine was converted using `.toJSON()`. This has now been fixed.
|
|
1081
1218
|
|
|
1082
|
-
* [`e16e48e`](https://github.com/
|
|
1219
|
+
* [`e16e48e`](https://github.com/statelyai/xstate/commit/e16e48e05e6243a3eacca58a13d3e663cd641f55) [#1153](https://github.com/statelyai/xstate/pull/1153) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with `choose` and `pure` not being able to use actions defined in options.
|
|
1083
1220
|
|
|
1084
|
-
- [`d496ecb`](https://github.com/
|
|
1221
|
+
- [`d496ecb`](https://github.com/statelyai/xstate/commit/d496ecb11b26011f2382d1ce6c4433284a7b3e9b) [#1165](https://github.com/statelyai/xstate/pull/1165) Thanks [@davidkpiano](https://github.com/statelyai)! - XState will now warn if you define an `.onDone` transition on the root node. Root nodes which are "done" represent the machine being in its final state, and can no longer accept any events. This has been reported as confusing in [#1111](https://github.com/statelyai/xstate/issues/1111).
|
|
1085
1222
|
|
|
1086
1223
|
## 4.9.1
|
|
1087
1224
|
|
|
1088
1225
|
### Patch Changes
|
|
1089
1226
|
|
|
1090
|
-
- [`8a97785`](https://github.com/
|
|
1227
|
+
- [`8a97785`](https://github.com/statelyai/xstate/commit/8a97785055faaeb1b36040dd4dc04e3b90fa9ec2) [#1137](https://github.com/statelyai/xstate/pull/1137) Thanks [@davidkpiano](https://github.com/statelyai)! - Added docs for the `choose()` and `pure()` action creators, as well as exporting the `pure()` action creator in the `actions` object.
|
|
1091
1228
|
|
|
1092
|
-
* [`e65dee9`](https://github.com/
|
|
1229
|
+
* [`e65dee9`](https://github.com/statelyai/xstate/commit/e65dee928fea60df1e9f83c82fed8102dfed0000) [#1131](https://github.com/statelyai/xstate/pull/1131) Thanks [@wKovacs64](https://github.com/wKovacs64)! - Include the new `choose` action in the `actions` export from the `xstate` core package. This was missed in v4.9.0.
|
|
1093
1230
|
|
|
1094
1231
|
## 4.9.0
|
|
1095
1232
|
|
|
1096
1233
|
### Minor Changes
|
|
1097
1234
|
|
|
1098
|
-
- [`f3ff150`](https://github.com/
|
|
1235
|
+
- [`f3ff150`](https://github.com/statelyai/xstate/commit/f3ff150f7c50f402704d25cdc053b76836e447e3) [#1103](https://github.com/statelyai/xstate/pull/1103) Thanks [@davidkpiano](https://github.com/statelyai)! - Simplify the `TransitionConfigArray` and `TransitionConfigMap` types in order to fix excessively deep type instantiation TypeScript reports. This addresses [#1015](https://github.com/statelyai/xstate/issues/1015).
|
|
1099
1236
|
|
|
1100
|
-
* [`6c47b66`](https://github.com/
|
|
1237
|
+
* [`6c47b66`](https://github.com/statelyai/xstate/commit/6c47b66c3289ff161dc96d9b246873f55c9e18f2) [#1076](https://github.com/statelyai/xstate/pull/1076) Thanks [@Andarist](https://github.com/Andarist)! - Added support for conditional actions. It's possible now to have actions executed based on conditions using following:
|
|
1101
1238
|
|
|
1102
1239
|
```js
|
|
1103
1240
|
entry: [
|
|
@@ -1116,45 +1253,45 @@
|
|
|
1116
1253
|
|
|
1117
1254
|
### Patch Changes
|
|
1118
1255
|
|
|
1119
|
-
- [`1a129f0`](https://github.com/
|
|
1256
|
+
- [`1a129f0`](https://github.com/statelyai/xstate/commit/1a129f0f35995981c160d756a570df76396bfdbd) [#1073](https://github.com/statelyai/xstate/pull/1073) Thanks [@Andarist](https://github.com/Andarist)! - Cleanup internal structures upon receiving termination events from spawned actors.
|
|
1120
1257
|
|
|
1121
|
-
* [`e88aa18`](https://github.com/
|
|
1258
|
+
* [`e88aa18`](https://github.com/statelyai/xstate/commit/e88aa18431629e1061b74dfd4a961b910e274e0b) [#1085](https://github.com/statelyai/xstate/pull/1085) Thanks [@Andarist](https://github.com/Andarist)! - Fixed an issue with data expressions of root's final nodes being called twice.
|
|
1122
1259
|
|
|
1123
|
-
- [`88b17b2`](https://github.com/
|
|
1260
|
+
- [`88b17b2`](https://github.com/statelyai/xstate/commit/88b17b2476ff9a0fbe810df9d00db32c2241cd6e) [#1090](https://github.com/statelyai/xstate/pull/1090) Thanks [@rjdestigter](https://github.com/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:
|
|
1124
1261
|
|
|
1125
1262
|
- Cloned state machine returned by `.withConfig`.
|
|
1126
1263
|
- `.state` getter defined for services.
|
|
1127
1264
|
- `start` method of services.
|
|
1128
1265
|
|
|
1129
|
-
* [`d5f622f`](https://github.com/
|
|
1266
|
+
* [`d5f622f`](https://github.com/statelyai/xstate/commit/d5f622f68f4065a2615b5a4a1caae6b508b4840e) [#1069](https://github.com/statelyai/xstate/pull/1069) Thanks [@davidkpiano](https://github.com/statelyai)! - Loosened event type for `SendAction<TContext, AnyEventObject>`
|
|
1130
1267
|
|
|
1131
1268
|
## 4.8.0
|
|
1132
1269
|
|
|
1133
1270
|
### Minor Changes
|
|
1134
1271
|
|
|
1135
|
-
- [`55aa589`](https://github.com/
|
|
1272
|
+
- [`55aa589`](https://github.com/statelyai/xstate/commit/55aa589648a9afbd153e8b8e74cbf2e0ebf573fb) [#960](https://github.com/statelyai/xstate/pull/960) Thanks [@davidkpiano](https://github.com/statelyai)! - The machine can now be safely JSON-serialized, using `JSON.stringify(machine)`. The shape of this serialization is defined in `machine.schema.json` and reflected in `machine.definition`.
|
|
1136
1273
|
|
|
1137
1274
|
Note that `onEntry` and `onExit` have been deprecated in the definition in favor of `entry` and `exit`.
|
|
1138
1275
|
|
|
1139
1276
|
### Patch Changes
|
|
1140
1277
|
|
|
1141
|
-
- [`1ae31c1`](https://github.com/
|
|
1278
|
+
- [`1ae31c1`](https://github.com/statelyai/xstate/commit/1ae31c17dc81fb63e699b4b9bf1cf4ead023001d) [#1023](https://github.com/statelyai/xstate/pull/1023) Thanks [@Andarist](https://github.com/Andarist)! - Fixed memory leak - `State` objects had been retained in closures.
|
|
1142
1279
|
|
|
1143
1280
|
## 4.7.8
|
|
1144
1281
|
|
|
1145
1282
|
### Patch Changes
|
|
1146
1283
|
|
|
1147
|
-
- [`520580b`](https://github.com/
|
|
1284
|
+
- [`520580b`](https://github.com/statelyai/xstate/commit/520580b4af597f7c83c329757ae972278c2d4494) [#967](https://github.com/statelyai/xstate/pull/967) Thanks [@andrewgordstewart](https://github.com/andrewgordstewart)! - Add context & event types to InvokeConfig
|
|
1148
1285
|
|
|
1149
1286
|
## 4.7.7
|
|
1150
1287
|
|
|
1151
1288
|
### Patch Changes
|
|
1152
1289
|
|
|
1153
|
-
- [`c8db035`](https://github.com/
|
|
1290
|
+
- [`c8db035`](https://github.com/statelyai/xstate/commit/c8db035b90a7ab4a557359d493d3dd7973dacbdd) [#936](https://github.com/statelyai/xstate/pull/936) Thanks [@davidkpiano](https://github.com/statelyai)! - The `escalate()` action can now take in an expression, which will be evaluated against the `context`, `event`, and `meta` to return the error data.
|
|
1154
1291
|
|
|
1155
|
-
* [`2a3fea1`](https://github.com/
|
|
1292
|
+
* [`2a3fea1`](https://github.com/statelyai/xstate/commit/2a3fea18dcd5be18880ad64007d44947cc327d0d) [#952](https://github.com/statelyai/xstate/pull/952) Thanks [@davidkpiano](https://github.com/statelyai)! - 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.
|
|
1156
1293
|
|
|
1157
|
-
- [`f86d419`](https://github.com/
|
|
1294
|
+
- [`f86d419`](https://github.com/statelyai/xstate/commit/f86d41979ed108e2ac4df63299fc16f798da69f7) [#957](https://github.com/statelyai/xstate/pull/957) Thanks [@Andarist](https://github.com/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.
|
|
1158
1295
|
|
|
1159
1296
|
## 4.7.6
|
|
1160
1297
|
|