You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actions are now in predictable order by default, so the `predictableActionArguments` flag is no longer required. Assign actions will always run in the order they are defined.
174
211
175
212
<Tabs>
176
-
<TabItemvalue="v5"label="XState v5">
213
+
<TabItemvalue="v5"label="XState v5 beta">
177
214
178
215
```ts
179
216
// ✅
@@ -234,7 +271,7 @@ Breaking change
234
271
Implementation functions now take in a single argument: an object with `context`, `event`, and other properties.
235
272
236
273
<Tabs>
237
-
<TabItemvalue="v5"label="XState v5">
274
+
<TabItemvalue="v5"label="XState v5 beta">
238
275
239
276
```ts
240
277
// ✅
@@ -274,7 +311,7 @@ The `send(...)` action creator is removed. Use `raise(...)` for sending events t
274
311
Read the documentation on the [`sendTo` action](actions.mdx#send-to-action) and [`raise` action](actions.mdx#raise-action) for more information.
275
312
276
313
<Tabs>
277
-
<TabItemvalue="v5"label="XState v5">
314
+
<TabItemvalue="v5"label="XState v5 beta">
278
315
279
316
```ts
280
317
// ✅
@@ -324,7 +361,7 @@ Breaking change
324
361
String event types can no longer be sent to, e.g., `actor.send(event)`; you must send an event object instead:
325
362
326
363
<Tabs>
327
-
<TabItemvalue="v5"label="XState v5">
364
+
<TabItemvalue="v5"label="XState v5 beta">
328
365
329
366
```ts
330
367
// ✅
@@ -356,7 +393,7 @@ Breaking change
356
393
String event types can no longer be sent to, e.g., `state.can(event)`; you must send an event object instead:
357
394
358
395
<Tabs>
359
-
<TabItemvalue="v5"label="XState v5">
396
+
<TabItemvalue="v5"label="XState v5 beta">
360
397
361
398
```ts
362
399
// ✅
@@ -386,7 +423,7 @@ Breaking change
386
423
The `cond` transition property for guarded transitions is now called `guard`:
387
424
388
425
<Tabs>
389
-
<TabItemvalue="v5"label="XState v5">
426
+
<TabItemvalue="v5"label="XState v5 beta">
390
427
391
428
```ts
392
429
const machine =createMachine({
@@ -430,7 +467,7 @@ Breaking change
430
467
Properties other than `type` on action objects and guard objects should be nested under a `params` property; `{ type: 'someType', message: 'hello' }` becomes `{ type: 'someType', params: { message: 'hello' }}`:
431
468
432
469
<Tabs>
433
-
<TabItemvalue="v5"label="XState v5">
470
+
<TabItemvalue="v5"label="XState v5 beta">
434
471
435
472
```ts
436
473
// ✅
@@ -474,7 +511,7 @@ Breaking change
474
511
Strict mode is removed. If you want to throw on unhandled events, you should use a wildcard transition:
475
512
476
513
<Tabs>
477
-
<TabItemvalue="v5"label="XState v5">
514
+
<TabItemvalue="v5"label="XState v5 beta">
478
515
479
516
```ts
480
517
// ✅
@@ -523,7 +560,7 @@ Breaking change
523
560
Eventless (“always”) transitions must now be defined through the `always: { ... }` property of a state node; they can no longer be defined via an empty string:
524
561
525
562
<Tabs>
526
-
<TabItemvalue="v5"label="XState v5">
563
+
<TabItemvalue="v5"label="XState v5 beta">
527
564
528
565
```ts
529
566
// ✅
@@ -577,7 +614,7 @@ Breaking change
577
614
External transitions previously specified with `internal: false` are now specified with `reenter: true`:
578
615
579
616
<Tabs>
580
-
<TabItemvalue="v5"label="XState v5">
617
+
<TabItemvalue="v5"label="XState v5 beta">
581
618
582
619
```ts
583
620
// ✅
@@ -623,7 +660,7 @@ Breaking change
623
660
The `in: 'someState'` transition property is removed. Use `guard: stateIn(...)` instead:
624
661
625
662
<Tabs>
626
-
<TabItemvalue="v5"label="XState v5">
663
+
<TabItemvalue="v5"label="XState v5 beta">
627
664
628
665
```ts
629
666
// ✅
@@ -667,7 +704,7 @@ Breaking change
667
704
The `state.history` property is removed. If you want the previous snapshot, you should maintain that via `actor.subscribe(...)` instead.
668
705
669
706
<Tabs>
670
-
<TabItemvalue="v5"label="XState v5">
707
+
<TabItemvalue="v5"label="XState v5 beta">
671
708
672
709
```ts
673
710
// ✅
@@ -717,7 +754,7 @@ The available actor logic creators are:
### `interpret()` accepts a second argument to restore state
964
+
### `createActor()` (formerly `interpret()`) accepts a second argument to restore state
928
965
929
966
:::breakingchange
930
967
931
968
Breaking change
932
969
933
970
:::
934
971
935
-
`interpret(machine).start(state)` is now `interpret(machine, { state }).start()`
972
+
`interpret(machine).start(state)` is now `createActor(machine, { state }).start()`
936
973
937
-
To restore an actor at a specific state, you should now pass the state into the `state` property of the `options` argument of `interpret(logic, options)`. The `actor.start()` property no longer takes in a `state` argument.
974
+
To restore an actor at a specific state, you should now pass the state into the `state` property of the `options` argument of `createActor(logic, options)`. The `actor.start()` property no longer takes in a `state` argument.
938
975
939
976
<Tabs>
940
-
<TabItemvalue="v5"label="XState v5">
977
+
<TabItemvalue="v5"label="XState v5 beta">
941
978
942
979
```ts
943
980
// ✅
944
-
const actor =interpret(machine, { state: someState });
981
+
const actor =createActor(machine, { state: someState });
945
982
actor.start();
946
983
```
947
984
@@ -969,11 +1006,11 @@ Breaking change
969
1006
Subscribing to an actor (`actor.subscribe(...)`) after the actor has started will no longer emit the current snapshot immediately. Instead, read the current snapshot from `actor.getSnapshot()`:
970
1007
971
1008
<Tabs>
972
-
<TabItemvalue="v5"label="XState v5">
1009
+
<TabItemvalue="v5"label="XState v5 beta">
973
1010
974
1011
```ts
975
1012
// ✅
976
-
const actor =interpret(machine);
1013
+
const actor =createActor(machine);
977
1014
actor.start();
978
1015
979
1016
const initialState =actor.getSnapshot();
@@ -1012,7 +1049,7 @@ Breaking change
1012
1049
The `actor.batch([...])` method for batching events is removed.
1013
1050
1014
1051
<Tabs>
1015
-
<TabItemvalue="v5"label="XState v5">
1052
+
<TabItemvalue="v5"label="XState v5 beta">
1016
1053
1017
1054
```ts
1018
1055
// ✅
@@ -1048,7 +1085,7 @@ Breaking change
1048
1085
The `machineConfig.schema` property is renamed to `machineConfig.types`:
1049
1086
1050
1087
<Tabs>
1051
-
<TabItemvalue="v5"label="XState v5">
1088
+
<TabItemvalue="v5"label="XState v5 beta">
1052
1089
1053
1090
```ts
1054
1091
// ✅
@@ -1096,7 +1133,7 @@ Breaking change
1096
1133
`machineConfig.tsTypes` has been renamed and is now nested as `machineConfig.types.typegen`:
0 commit comments