-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(xstate-tree): canHandleEvent triggering side effects
Due to the fact canHandleEvent just worked out the next state for an event and whether it had changed, the interpreter evaluates any assign actions associated with the event. This results in any assign actions that cause side effects from being executed mistakenly. Since `canHandleEvent` was originally created xstate has a new `state.can` method which is better suited for this and doesn't cause the assign actions to be executed. So while you should not have side effects in your assign actions, if you do for some reason this won't trigger them when calling `canHandleEvent`
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
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
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