-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cyclical always
transitions result in "Maximum callstack exceeded" error
#22
Comments
Someone in Discord pointed out that inlining the guards makes the error go away. Unfortunately, doing that prevents you from using the visual editor. |
Huh, inlining a guard vs referencing a guard should definitely not result in such a behavior difference. This is definitely a bug - and most likely in XState itself |
To be clear, the machine executes properly at runtime regardless of where the guard is defined. It seems the VSCode extension just can't handle cyclic |
Found a fix for this. XState was erroring too soon when you didn't provide a guard that was checked as part of an initial state. So we extract a bunch of 'guards to mock' from the machine definition. By default, we were setting these guards as |
(reopening pending @wKovacs64 feedback on a version distributed privately) |
For those following along at home, it worked! |
This codesandbox includes a 2 state example. I've also experienced the same behavior with 3 states so assume it's related any cycle from
always
transitions.Additionally, the inspector doesn't render anything when this cycle is present. But after commenting an
always
transition in the cycle, it renders correctly.This renders correctly in the visualizer (independent of the vscode extension) with no issues.
The text was updated successfully, but these errors were encountered: