-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use defaultActionExecutor (temp) * Convert entry/exit events * UnknownAction -> UnknownActionObject * Use defaultActionExecutor * Cleanup * WIP * Fixing tests * Add toJSON to built-in actions * Add docs * Update packages/core/src/actions/spawnChild.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Update packages/core/src/stateUtils.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Unify convertAction * Update packages/core/src/stateUtils.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Remove TODO * Introduce `executeAction`, remove `action.execute()` * Enqueue actions test * Fix type error * Expose `executeAction(…)` * Provide actor to action * Fix type issue * Changeset * Deprecate getNextSnapshot and getInitialSnapshot * Update packages/core/src/stateUtils.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Restore getNextSnapshot.test.ts file * function -> exec * Delayed raise action test * Getting close * Update scheduler to handle delayed sendTo actions without an initially resolved target * Fix types * WIP * Remove test code * Default actor * Serialization in test * Revert invoke.test.ts * Cancel action execution * WIP * Update launch.json and jest.config.js * Proof of concept for invoked actions * Include resolved input & systemId in spawnChild action * Refactor action types to use ExecutableActionObject and add startedAt timestamp to raise and send actions * Add ExecutableActionsFrom * Clean up types * Lint * Lint for real * Lint lint * Back to any * Update packages/core/test/transition.test.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * use sleep * remove outdated comment * add `ExecutableSendToAction` to `SpecialExecutableAction` * remove `startedAt` * add failing raise test case * tweak test title * add extra cancel tests * add failing test for invalid event delivery * Revert test (happens in main) * Remove invalid test: The <cancel> element is used to cancel a delayed <send> event. * Fixed tests * remove unused import * add warn assertions * Revert "Remove invalid test: The <cancel> element is used to cancel a delayed <send> event." This reverts commit ab4bad0. * make it green, make it green * add action resolution capabilities to machine.executeAction * share `resolvedInfo` between branches * bring back `ExecutableActionObject['exec']` * add a failing boilerplate for `cancel` execution * Fix cancel action * Add SpecialActionResolution type * Add test for sendTo action * actorId -> targetId * Rename * Add tests for emit and log * Remove switch statement in executeAction * Undo * Remove executeAction for now * bring back one `toSerializableAction` call * fix one type issue * tweak test titles * remove redundant test * dont export `getAction` --------- Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
- Loading branch information
1 parent
d67b71d
commit 8c4b706
Showing
34 changed files
with
1,501 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
'xstate': minor | ||
--- | ||
|
||
Added a new `transition` function that takes an actor logic, a snapshot, and an event, and returns a tuple containing the next snapshot and the actions to execute. This function is a pure function and does not execute the actions itself. It can be used like this: | ||
|
||
```ts | ||
import { transition } from 'xstate'; | ||
|
||
const [nextState, actions] = transition(actorLogic, currentState, event); | ||
// Execute actions as needed | ||
``` | ||
|
||
Added a new `initialTransition` function that takes an actor logic and an optional input, and returns a tuple containing the initial snapshot and the actions to execute from the initial transition. This function is also a pure function and does not execute the actions itself. It can be used like this: | ||
|
||
```ts | ||
import { initialTransition } from 'xstate'; | ||
|
||
const [initialState, actions] = initialTransition(actorLogic, input); | ||
// Execute actions as needed | ||
``` | ||
|
||
These new functions provide a way to separate the calculation of the next snapshot and actions from the execution of those actions, allowing for more control and flexibility in the transition process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.