-
Notifications
You must be signed in to change notification settings - Fork 63
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
Error: Unable to evaluate guard in transition for event #31
Comments
We shouldn't do this because it will do different behavior than if you were to use the exact same machine in an application. It should error out because the guard needs to be defined. That is, why assume it returns This ambiguity should be highlighted, and we can display some sort of error that the guard cannot be evaluated because it is not implemented. |
@davidkpiano For it to be useful, the developer must be the one to decide which value the guard should take. Currently, it's not clear which guards aren't implemented when loading a configuration that omits them. Ideally, the Visualizer would:
|
I think perhaps we should get some clarity on the purpose of the visualizer for this. Having options, including If the visualiser is intended to be used separate to that understanding/use case that would be great (and I can document it). |
If I chick a transition, shouldn't that mean the guard is returning true? otherwise, I would click the other transition, right? At least for the click scenario, I see the guarded transitions as two distinct transitions, I'm guessing that's not what is happening. I'm using the viz in vscode, and there's no way (i think) to send a specific event with payload, but regardless I just want to play with the machine with clicks to make videos, as a simulation where the truth is what I click. Also for other non-tech team members, it is super useful, just an interactive diagram of what is happening based on the machine definition with strings. I'm not sure if it is a bug, but sometimes I click a guarded transition and it takes me to another |
Description
Loading the Visualizer with machine configurations that omit a guard's implementation currently causes the triggering of an error when an attempt is made to transition through it.
Minimal reproduction:
The source Gist
The Visualizer loaded with the Gist
Suggested solution:
Implement all omitted guard implementations as a function returning
true
, allowing users to transition through guards.Optionally enable this behaviour only under a configuration prop such that other consumers of the XState-Viz React component will be able to turn this behaviour off when it's not appropriate for their use-case (e.g. Browser DevTools from issue #30)
The text was updated successfully, but these errors were encountered: