xstate 6.0.0-beta.1 → 6.0.0-beta.3
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/README.md +4 -2
- package/dist/{createActor-cbe3abac.esm.js → createActor-49ea55ba.esm.js} +259 -47
- package/dist/{createActor-25900f76.cjs.js → createActor-73aa92ba.cjs.js} +261 -46
- package/dist/{createActor-551369be.development.esm.js → createActor-a085b20b.development.esm.js} +260 -48
- package/dist/{createActor-a49ae0ce.development.cjs.js → createActor-dfb6b790.development.cjs.js} +262 -47
- package/dist/declarations/src/createActor.d.ts +3 -1
- package/dist/declarations/src/createMachine.d.ts +6 -3
- package/dist/declarations/src/durable/index.d.ts +43 -8
- package/dist/declarations/src/effectDescriptor.d.ts +2 -2
- package/dist/declarations/src/fsm.d.ts +7 -7
- package/dist/declarations/src/machineVersion.types.d.ts +2 -2
- package/dist/declarations/src/setup.d.ts +2 -2
- package/dist/declarations/src/systemTransition.d.ts +1 -1
- package/dist/declarations/src/types.d.ts +4 -2
- package/dist/declarations/src/types.v6.d.ts +37 -2
- package/dist/{effectDescriptor-2fa27c54.cjs.js → effectDescriptor-3402f63e.cjs.js} +5 -5
- package/dist/{effectDescriptor-d8b0f749.esm.js → effectDescriptor-65821048.development.esm.js} +5 -5
- package/dist/{effectDescriptor-321a8ce9.development.esm.js → effectDescriptor-72c62058.esm.js} +5 -5
- package/dist/{effectDescriptor-f73da4ec.development.cjs.js → effectDescriptor-d0ea44ad.development.cjs.js} +5 -5
- package/dist/{machineSchemas-b5736804.development.esm.js → legacySnapshot-11aba2d2.development.esm.js} +117 -3
- package/dist/{machineSchemas-6d96bef4.development.cjs.js → legacySnapshot-2e2c1d3b.development.cjs.js} +118 -2
- package/dist/{machineSchemas-88d01821.cjs.js → legacySnapshot-a85dfbe2.cjs.js} +117 -1
- package/dist/{machineSchemas-45c21bc2.esm.js → legacySnapshot-fffe81a0.esm.js} +116 -2
- package/dist/xstate-actors.cjs.js +30 -5
- package/dist/xstate-actors.development.cjs.js +30 -5
- package/dist/xstate-actors.development.esm.js +31 -6
- package/dist/xstate-actors.esm.js +31 -6
- package/dist/xstate-actors.umd.min.js +1 -1
- package/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/xstate-durable.cjs.js +120 -10
- package/dist/xstate-durable.development.cjs.js +120 -10
- package/dist/xstate-durable.development.esm.js +120 -10
- package/dist/xstate-durable.esm.js +120 -10
- package/dist/xstate-durable.umd.min.js +1 -1
- package/dist/xstate-durable.umd.min.js.map +1 -1
- package/dist/xstate-fsm.cjs.js +61 -31
- package/dist/xstate-fsm.development.cjs.js +61 -31
- package/dist/xstate-fsm.development.esm.js +61 -31
- package/dist/xstate-fsm.esm.js +61 -31
- package/dist/xstate-fsm.umd.min.js +1 -1
- package/dist/xstate-fsm.umd.min.js.map +1 -1
- package/dist/xstate-graph.cjs.js +1 -1
- package/dist/xstate-graph.development.cjs.js +1 -1
- package/dist/xstate-graph.development.esm.js +2 -2
- package/dist/xstate-graph.esm.js +2 -2
- package/dist/xstate-graph.umd.min.js +1 -1
- package/dist/xstate-graph.umd.min.js.map +1 -1
- package/dist/xstate-persist.cjs.js +23 -12
- package/dist/xstate-persist.development.cjs.js +23 -12
- package/dist/xstate-persist.development.esm.js +17 -6
- package/dist/xstate-persist.esm.js +17 -6
- package/dist/xstate-persist.umd.min.js +1 -1
- package/dist/xstate-persist.umd.min.js.map +1 -1
- package/dist/xstate-validation.cjs.js +1 -1
- package/dist/xstate-validation.development.cjs.js +1 -1
- package/dist/xstate-validation.development.esm.js +1 -1
- package/dist/xstate-validation.esm.js +1 -1
- package/dist/xstate.cjs.js +86 -56
- package/dist/xstate.development.cjs.js +86 -56
- package/dist/xstate.development.esm.js +76 -46
- package/dist/xstate.esm.js +76 -46
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/docs/actor-logic.md +1 -1
- package/docs/api-stability.json +335 -305
- package/docs/backend-workflows.md +3 -3
- package/docs/durable-execution.md +72 -48
- package/docs/errors.md +2 -2
- package/docs/examples.md +34 -34
- package/docs/faq.md +1 -1
- package/docs/fsm.md +54 -10
- package/docs/guards.md +1 -1
- package/docs/index.md +2 -1
- package/docs/inspect-actor-systems.md +20 -3
- package/docs/inspection.md +5 -1
- package/docs/invoke.md +36 -4
- package/docs/migrate-inspector.md +141 -0
- package/docs/persistence.md +16 -10
- package/docs/serialization.md +1 -1
- package/docs/setup-and-provide.md +3 -3
- package/docs/spawn.md +1 -1
- package/docs/system-transitions.md +8 -6
- package/docs/transitions.md +5 -1
- package/docs/tutorial.md +5 -5
- package/docs/typescript.md +9 -0
- package/docs/xstate-v5-to-v6.md +23 -21
- package/package.json +1 -1
package/docs/xstate-v5-to-v6.md
CHANGED
|
@@ -34,7 +34,7 @@ This guide is organized by area. Skim the **Quick reference** below and read [§
|
|
|
34
34
|
| `types: {} as { context: ..., events: ...}` | `schemas: { context, events, ... }` (Zod / Standard Schema, or `types<T>()` for type-only) |
|
|
35
35
|
| `actor.send({ type: 'INC' })` | `actor.send(...)` keeps working; new typed `actor.trigger.INC()` |
|
|
36
36
|
| `@xstate/immer` | removed - return updated `context` patches directly |
|
|
37
|
-
| `@xstate/inspect` | removed - use `inspect` option on `createActor`, `actor.subscribe`, or [`@statelyai/inspect`](
|
|
37
|
+
| `@xstate/inspect` | removed - use `inspect` option on `createActor`, `actor.subscribe`, or [`@statelyai/sdk/inspect`](migrate-inspector.md) |
|
|
38
38
|
| `sendTo('child', ev)` with no running `child` | dead letter with reason `'missingTarget'`; the sender stays `active` (§26) |
|
|
39
39
|
| `tsTypes` (typegen) | removed; declare types with `schemas` (§3) |
|
|
40
40
|
| `machine.implementations` | `machine.sources` |
|
|
@@ -79,12 +79,12 @@ Beyond simplifying the action/guard surface, v6 introduces a number of features
|
|
|
79
79
|
|
|
80
80
|
## 1. Inline functions replace action creators
|
|
81
81
|
|
|
82
|
-
This is the largest change. Action creators (`assign`, `raise`, `sendTo`, `emit`, `log`, `cancel`, `enqueueActions`, `spawnChild`, `stopChild`, `forwardTo`, `sendParent`) are
|
|
82
|
+
This is the largest change. Action creators (`assign`, `raise`, `sendTo`, `emit`, `log`, `cancel`, `enqueueActions`, `spawnChild`, `stopChild`, `forwardTo`, `sendParent`) are no longer exported.
|
|
83
83
|
|
|
84
|
-
In v6, every `entry`, `exit`, and transition handler is a **single function** that receives `(args, enq)` where `enq` is a queue of side effects. The function can also
|
|
84
|
+
In v6, every `entry`, `exit`, and transition handler is a **single function** that receives `(args, enq)` where `enq` is a queue of side effects. The function can also return an object that the engine applies after it runs:
|
|
85
85
|
|
|
86
86
|
- **Transition handlers** (`on`, `always`, `after`, `onTimeout`, `onDone`, `onError`) - may return a target, a new `context`, `reenter`, or `meta`.
|
|
87
|
-
- **Entry / exit actions** - may return a new `context` (or `children`). They
|
|
87
|
+
- **Entry / exit actions** - may return a new `context` (or `children`). They cannot return a `target`; entry/exit cannot transition.
|
|
88
88
|
|
|
89
89
|
Returned `context` values are patches. XState merges a patch into the current context at the top level (`{ ...context, ...patch }`): omitted keys keep their current values, and a nested object in the patch replaces the current value of that key. If a transition targets a state with a narrower `schemas.context`, the patch type requires the keys needed to satisfy that state's context.
|
|
90
90
|
|
|
@@ -241,7 +241,7 @@ An **entry / exit action** may return:
|
|
|
241
241
|
| `context` | shallow context patch |
|
|
242
242
|
| `children` | replacement children record |
|
|
243
243
|
|
|
244
|
-
Returning nothing (`undefined`) means "no changes". For transition handlers specifically, returning nothing without calling `enq` also means
|
|
244
|
+
Returning nothing (`undefined`) means "no changes". For transition handlers specifically, returning nothing without calling `enq` also means the event is treated as unhandled at this state - useful for inline guarding. A handler that calls `enq` is taken even when it returns nothing, so check the condition first:
|
|
245
245
|
|
|
246
246
|
```ts
|
|
247
247
|
// v6 - guard inline by returning undefined
|
|
@@ -306,8 +306,8 @@ runs, because the two exit sets no longer overlap.
|
|
|
306
306
|
```ts
|
|
307
307
|
// Parallel state `p` with regions `a` and `b`.
|
|
308
308
|
// Event `t`: `a` reenters itself; `b.b1` moves to `b.b2`.
|
|
309
|
-
// v5 after `t`: { a: 'a1', b: 'b1' }
|
|
310
|
-
// v6 after `t`: { a: 'a1', b: 'b2' }
|
|
309
|
+
// v5 after `t`: { a: 'a1', b: 'b1' }: `b` was reset when `p` was exited.
|
|
310
|
+
// v6 after `t`: { a: 'a1', b: 'b2' }: only `a` was exited.
|
|
311
311
|
```
|
|
312
312
|
|
|
313
313
|
Reset the sibling regions explicitly if the v5 behavior was intended: target
|
|
@@ -737,7 +737,7 @@ const fetchUser = createAsyncLogic({
|
|
|
737
737
|
});
|
|
738
738
|
```
|
|
739
739
|
|
|
740
|
-
`enq.step(key, exec)` records each step's outcome on the snapshot under `effects[key]`, so on rehydration the step is
|
|
740
|
+
`enq.step(key, exec)` records each step's outcome on the snapshot under `effects[key]`, so on rehydration the step is not re-executed - the previous result is replayed. This makes async logic durable across restarts.
|
|
741
741
|
|
|
742
742
|
When `timeout` elapses, the logic aborts and rejects with `TimeoutError` (also exported):
|
|
743
743
|
|
|
@@ -942,8 +942,8 @@ on: {
|
|
|
942
942
|
|
|
943
943
|
## 12. Internal events
|
|
944
944
|
|
|
945
|
-
Events declared in `schemas.internalEvents` can be
|
|
946
|
-
are
|
|
945
|
+
Events declared in `schemas.internalEvents` can be raised internally but
|
|
946
|
+
are rejected by the public actor protocol. Wildcard patterns are supported.
|
|
947
947
|
|
|
948
948
|
```ts
|
|
949
949
|
const machine = createMachine({
|
|
@@ -1014,7 +1014,7 @@ states: {
|
|
|
1014
1014
|
|
|
1015
1015
|
The function must resolve to a target - returning `undefined` throws "must resolve to a target".
|
|
1016
1016
|
|
|
1017
|
-
Choice states are entered automatically by routing
|
|
1017
|
+
Choice states are entered automatically by routing into them. They cannot themselves declare `invoke`, `after`, `on`, or `entry`/`exit` (machine creation rejects these).
|
|
1018
1018
|
|
|
1019
1019
|
---
|
|
1020
1020
|
|
|
@@ -1046,7 +1046,7 @@ State `timeout` and `createAsyncLogic({ timeout })` accept `number` (ms) or `str
|
|
|
1046
1046
|
| Seconds | `'5s'`, `'1.5s'` | integer or decimal + `s` suffix |
|
|
1047
1047
|
| ISO 8601 duration | `'PT5S'`, `'PT1M30S'`, `'PT2H'`, `'P1D'`, `'P1W'`, `'P1DT12H'` | always starts with `P` |
|
|
1048
1048
|
|
|
1049
|
-
Plain `'5m'`, `'1h'`, `'1d'`, `'1w'` (without the `P`/`PT` prefix) are
|
|
1049
|
+
Plain `'5m'`, `'1h'`, `'1d'`, `'1w'` (without the `P`/`PT` prefix) are not accepted - use the ISO 8601 form for anything beyond seconds and milliseconds.
|
|
1050
1050
|
|
|
1051
1051
|
`after` delays accept the same duration formats. A string delay is resolved against the machine's named `delays` first; only strings that don't match a named delay are parsed as durations.
|
|
1052
1052
|
|
|
@@ -1089,7 +1089,7 @@ loop until the process ran out of memory.
|
|
|
1089
1089
|
|
|
1090
1090
|
<!-- exports removed from and added to packages/core/src/index.ts on the v6 branch (relative to main / v5) -->
|
|
1091
1091
|
|
|
1092
|
-
These exports have been
|
|
1092
|
+
These exports have been removed from `xstate`:
|
|
1093
1093
|
|
|
1094
1094
|
- Action creators (entire `actions.ts` module): `assign`, `raise`, `sendTo`, `sendParent`, `forwardTo`, `emit`, `log`, `cancel`, `enqueueActions`, `spawnChild`, `stopChild`, `stop`, plus their `*Action`/`*Params` types
|
|
1095
1095
|
- Guard combinators and helpers: `and`, `or`, `not`, `stateIn`
|
|
@@ -1116,7 +1116,7 @@ These exports have been **removed** from `xstate`:
|
|
|
1116
1116
|
|
|
1117
1117
|
`SetupReturn`, the type returned by `setup(...)`, is still exported, but its type parameters changed, so a v5 `SetupReturn<TContext, TEvent, ...>` annotation no longer type-checks. Use `typeof yourSetup` to name the type of a specific setup.
|
|
1118
1118
|
|
|
1119
|
-
These exports have been
|
|
1119
|
+
These exports have been added:
|
|
1120
1120
|
|
|
1121
1121
|
- `setup` (reshaped - see §4) and `createSystem` for typed system registries
|
|
1122
1122
|
- Setup state contract types: `SetupStateSchema`, `SetupStateSchemas`, `SetupStateType`
|
|
@@ -1146,7 +1146,7 @@ See [compact finite state machines](fsm.md) for its exact supported surface.
|
|
|
1146
1146
|
- The executable action types are now executable effect types: `ExecutableActionObject` is `ExecutableEffect`, `ExecutableActionsFrom` is `ExecutableEffectFrom`, `SpecialExecutableAction` is `SpecialExecutableEffect`, `ExecutableSpawnAction` is `SpawnExecutableEffect`, and `ToExecutableAction` is `ToExecutableEffect`. The new v6 types and helpers use the same naming, for example `BuiltInExecutableEffect` and `isBuiltInExecutableEffect`.
|
|
1147
1147
|
- `snapshot._nodes` is now `snapshot.nodes`. It lists the active state nodes.
|
|
1148
1148
|
- Implicit state ids no longer use the `(machine)` placeholder. A state's implicit id is its path from the root joined by `.`, prefixed by the machine `id` when the machine has one: `shop.checkout` for `id: 'shop'`, and `checkout` without an id (v5: `(machine).checkout`). `machine.id` and the root's id are `''` for a machine without an `id`, so `#` cannot reference that root; give the machine an `id` to target it. An explicit state `id` that equals another state's id throws.
|
|
1149
|
-
- Bare string transition values (`on: { GO: 'next' }`, `after: { 1000: 'idle' }`, `always: 'ready'`, `onDone: 'done'`) throw when the machine is created: `Transition for "GO" in state "idle" is the string "next". Use { target: 'next' }.` Write `{ target: 'next' }`; the `string-targets` codemod transform rewrites them. `initial` keeps its string form
|
|
1149
|
+
- Bare string transition values (`on: { GO: 'next' }`, `after: { 1000: 'idle' }`, `always: 'ready'`, `onDone: 'done'`) throw when the machine is created: `Transition for "GO" in state "idle" is the string "next". Use { target: 'next' }.` Write `{ target: 'next' }`; the `string-targets` codemod transform rewrites them. `initial` keeps its string form. `xstate/fsm` also requires object targets for `on` and `always`.
|
|
1150
1150
|
- `#` targets and `matches('#…')` resolve by exact id. v5 split the text after `#` at the first `.` and resolved the rest as a path below that id, so `#flow.review` meant "child `review` of the state with id `flow`". In v6, the whole string after `#` is the id: use the target state's own explicit `id`, or its full implicit id. This also applies to `@xstate.stateIn` guards in JSON. Dots in an explicit id are matched literally (`#checkout.v2` for `id: 'checkout.v2'`); v5 required `#checkout\\.v2`. An unresolvable target throws when the machine is created, and suggests the target's id when the old form resolves:
|
|
1151
1151
|
|
|
1152
1152
|
```ts
|
|
@@ -1204,6 +1204,8 @@ If you want Immer-style drafts, call Immer's `produce` yourself inside the inlin
|
|
|
1204
1204
|
|
|
1205
1205
|
### `@xstate/inspect` - removed
|
|
1206
1206
|
|
|
1207
|
+
For a visual inspector, use `createInspector` from `@statelyai/sdk/inspect`. See [Migrate to SDK inspection](migrate-inspector.md) for installation and changes from `@statelyai/inspect`.
|
|
1208
|
+
|
|
1207
1209
|
The standalone inspector package and its `inspect()` entry point are gone. Inspection now flows through:
|
|
1208
1210
|
|
|
1209
1211
|
- `actor.subscribe(observer)` - the snapshot stream
|
|
@@ -1275,7 +1277,7 @@ on: {
|
|
|
1275
1277
|
|
|
1276
1278
|
## 20. Persistence / rehydration
|
|
1277
1279
|
|
|
1278
|
-
Persisted snapshots round-trip through `JSON.stringify` and rehydrate via `restoreActor(machine, persisted)` from `xstate/persist`. The internal shape changed, so v5 persisted snapshots are
|
|
1280
|
+
Persisted snapshots round-trip through `JSON.stringify` and rehydrate via `restoreActor(machine, persisted)` from `xstate/persist`. The internal shape changed, so v5 persisted snapshots are not binary-compatible with v6 - drain or migrate stored state during your rollout.
|
|
1279
1281
|
|
|
1280
1282
|
```ts
|
|
1281
1283
|
import { restoreActor } from 'xstate/persist';
|
|
@@ -1296,7 +1298,7 @@ Child actors, async logic with effects, and listener-resume semantics are all pa
|
|
|
1296
1298
|
|
|
1297
1299
|
The host serializes the payload. Development builds warn when `context`, `output`, `error`, or state input holds a value that does not survive a JSON round-trip: functions, symbols, `BigInt`, `Map`, `Set`, cycles, `NaN`, and `Infinity`. Persisting a snapshot whose `context` contains a circular reference throws an error that names the actor and the context path. See [Persistence](persistence.md) for the format rules.
|
|
1298
1300
|
|
|
1299
|
-
Actor refs in persisted `context` are stored as `{ "
|
|
1301
|
+
Actor refs in persisted `context` are stored as `{ "@actor": "<address>" }`. v5 stored them as `{ "xstate$$type": 1, "id": "<id>" }`; v6 does not read that shape, so convert those entries with [`machineVersions`](persistence.md#migrate-machine-versions) before restoring v5 snapshots.
|
|
1300
1302
|
|
|
1301
1303
|
### Snapshot versioning
|
|
1302
1304
|
|
|
@@ -1630,7 +1632,7 @@ It runs these transforms in order. `--transform name,name` selects a subset.
|
|
|
1630
1632
|
| Transform | Effect |
|
|
1631
1633
|
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1632
1634
|
| `rename-imports` | Renames `interpret` to `createActor`, `Interpreter` to `Actor`, and `fromCallback`, `fromObservable`, and `fromEventObservable` to their `create*Logic` names, and the executable action types to their executable effect names, including usages. Import aliases are kept. |
|
|
1633
|
-
| `string-targets` | Wraps bare string transition values under `on`, `after`, `onDone`, `onError`, and `always` in `{ target: '...' }` inside `createMachine` and `
|
|
1635
|
+
| `string-targets` | Wraps bare string transition values under `on`, `after`, `onDone`, `onError`, and `always` in `{ target: '...' }` inside `createMachine`, `createStateConfig`, and `createFSM` configs. |
|
|
1634
1636
|
| `types-to-schemas` | Converts `types: {} as { ... }` and the per-key form `types: { context: {} as C, events: {} as E }` to `schemas` with `types<T>()` entries. Events become a map when they are written as a union of object literals with a string-literal `type`, inline or through type aliases declared in the same file. Other event types become `events: types<E>()`, which loads but does not type-check as a v6 event map, so the entry is reported as a manual site to rewrite as a map by hand. A `types` value in any other shape, such as a variable, is reported as a manual site. |
|
|
1635
1637
|
| `lower-actions` | Rewrites transition objects that have `actions` or `guard`, and transition arrays, as one transition function `(args, enq) => { ... }`; non-function `entry` and `exit` values as one function; and the action creators and guard combinators inside them (`assign`, `enqueueActions`, `raise`, `sendTo`, `sendParent`, `forwardTo`, `emit`, `log`, `cancel`, `stopChild`, `spawnChild`, `and`, `or`, `not`, `stateIn`) as `enq` calls, context patches and boolean expressions, following named implementations and module-level constants defined in the same file. Named actions and guards keep their v5 signatures; the generated code calls them as `enq(args.actions.name, args, params)` and `args.guards.name(args, params)`. A named `assign` action becomes a function that returns a context patch. Moves an object-literal second `createMachine` argument into the config, and rewrites `fromPromise(fn)` as `createAsyncLogic({ run: fn })` when `fn` does not read `system` or `emit`. Removes the `'xstate'` imports it leaves unused. A transition, `entry`, or `exit` value that contains anything it cannot rewrite, such as an `enqueueActions` callback that passes `enqueue` as a value or returns early, a guard or action defined in another file, or a named `assign` that `provide()` overrides, is left unchanged and reported by the transforms below. |
|
|
1636
1638
|
| `report-removed-apis` | Reports, without rewriting, uses of `assign`, `raise`, `sendTo`, `sendParent`, `forwardTo`, `emit`, `log`, `cancel`, `spawnChild`, `stop`, `stopChild`, `enqueueActions`, `and`, `or`, `not`, `stateIn`, `fromPromise`, `fromTransition`, `toObserver`, `pathToStateValue`, and `SpecialTargets`, with a suggested replacement. |
|
|
@@ -1752,7 +1754,7 @@ A diff that matches a known v6 change is classified with a rule instead of `uncl
|
|
|
1752
1754
|
| --- | --- |
|
|
1753
1755
|
| `anonymous-child-id` | Child or send-target ids that differ only by a generated suffix. |
|
|
1754
1756
|
| `error-string-shape` | Error strings with the same message after the prefix is removed. |
|
|
1755
|
-
| `context-reference` | `context` that is equal after removing actor-reference keys (
|
|
1757
|
+
| `context-reference` | `context` that is equal after removing actor-reference keys (`@actor`). |
|
|
1756
1758
|
| `done-event-session` | Processed events that are equal after dropping `sessionId`. |
|
|
1757
1759
|
| `final-state-output` | `output` that is undefined in v5 and set in v6, because v6 uses a top-level final state's `output` when the root has none (see [Machine output](#machine-output)). |
|
|
1758
1760
|
| `root-send-parent` | `status` and `error` where v5 errored with `Unable to send event to actor '#_parent'` and v6 did not, because v6 makes a send to a missing parent a dead letter (see [Sending to a missing target](#sending-to-a-missing-target)). Later fields of that step, such as `value`, can still differ. |
|
|
@@ -1840,7 +1842,7 @@ Code written against a v6 alpha uses names that changed before the beta. The old
|
|
|
1840
1842
|
| `xstate.system.cancelEffect`, `xstate.logic.cleanup` effects | `@xstate.cancelEffect`, `@xstate.cleanup` |
|
|
1841
1843
|
| `xstate.logic.effect`, `xstate.log` system effects | `@xstate.effect`, `@xstate.log` |
|
|
1842
1844
|
| suffixed `xstate.done.actor.<id>` etc. descriptors | category types with `matches` (see [Internal lifecycle events](#internal-lifecycle-events)) |
|
|
1843
|
-
| `{ xstate$type: 'actorRef', id, address, src }` | `{
|
|
1845
|
+
| `{ xstate$type: 'actorRef', id, address, src }` | `{ '@actor': address }` (`SerializedActorRef`; `$actor` in 6.0.0-beta.1) |
|
|
1844
1846
|
| persisted timer `startedAt` | `scheduledAt` |
|
|
1845
1847
|
| `snapshot.timers` record keyed by generated ids (`xstate.after.<delay>.<stateId>`, `xstate.timeout.state.<stateId>`, `xstate.timer.auto.<n>`) | list; built-in timers have no `id`, delayed sends without an `id` carry `seq` |
|
|
1846
1848
|
| `scheduleTimer(source, id, delay)`, `cancelTimer(source, id)`, `{ type: 'xstate.timer', id }` | `scheduleTimer(source, timer, delay)`, `cancelTimer(source, timer)`, `{ type: 'xstate.timer', ...timer }` (`TimerKey`) |
|
|
@@ -1994,7 +1996,7 @@ In v5, an undeclared delay name resolved to `undefined`, and the delayed transit
|
|
|
1994
1996
|
- [ ] If you used `events` as a **union**, restructure to a **map keyed by type**
|
|
1995
1997
|
- [ ] Move implementations passed as the second argument of `createMachine(config, implementations)` (deprecated in v5) into `setup({ ... })`, the `createMachine({ ... })` config, or `machine.provide({ ... })` (§4). v6's `createMachine` takes one argument and throws when it receives a second one
|
|
1996
1998
|
- [ ] Audit `invoke.src` references - `src` may be a logic object, a registered name, or a resolver function
|
|
1997
|
-
- [ ] Drop dependencies on `@xstate/immer` and `@xstate/inspect`; update inspection to `actor.subscribe`, the `inspect` option, or `@statelyai/inspect`
|
|
1999
|
+
- [ ] Drop dependencies on `@xstate/immer` and `@xstate/inspect`; update inspection to `actor.subscribe`, the `inspect` option, or `@statelyai/sdk/inspect`
|
|
1998
2000
|
- [ ] Remove imports of `GuardArgs`, `GuardPredicate`, `Inspected*Event`, `PromiseActorLogic`, and `fromPromise` (use `createAsyncLogic`), and update the type arguments of any `SetupReturn<...>` annotation (§16)
|
|
1999
2001
|
- [ ] Drain/migrate any v5 persisted snapshots - the v6 snapshot shape is not binary-compatible
|
|
2000
2002
|
- [ ] Check that persisted `context` holds only JSON values; development builds warn on functions, symbols, `BigInt`, `Map`, `Set`, cycles, `NaN`, and `Infinity`
|