xstate
xstate copied to clipboard
[v5] Actor reset
This PR introduces an actor.reset(persistedState?) method to reset an actor, either to its original initial state or a specified state. This can be a mechanism for actor supervision, where a parent actor can restart a failed actor.
The actor.reset method will:
- Stop the current actor
- Set its status to
ActorStatus.NotStarted - Initialize the actor's state to its initial state or the provided
persistedState
Restarting an actor can be done via:
actor.reset();
actor.start();
⚠️ No Changeset found
Latest commit: d3f88057e47f402649f35a994efa391725976146
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit d3f88057e47f402649f35a994efa391725976146:
| Sandbox | Source |
|---|---|
| XState Example Template | Configuration |
| XState React Template | Configuration |