xstate-tools
xstate-tools copied to clipboard
XState VSCode extension - Visual Editor shows unexpected errors when using multiple guarded transitions
Version
[email protected]
XState VSCode v2.0.0
Reproduce
- Go to https://stately.ai/docs/guards#multiple-guarded-transitions, there is an example for multiple guarded transitions.
- Paste the following code in VSCode editor:
const feedbackMachine = createMachine({ /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOgAcAnAe1TIBcBiAMzEgCMsBrc6gN1whgA2gAYAuolBkqsXHVxV8kkAA9EARgCsADhIA2ACwi9AJk0AaEAE9E29SU0BfR5bRY8hUpRr1mrCByY3N78gkLqEkgg0rLyispqCFq6hsZmljZJ2iYOzq4YOATEPD6MLOxcJaHCJpFSMnIKSlGJyfpGphbWGgDMJs4uIPhUgvBRboWeyjGN8S2IALR6GYt6eSATHsXetHTTDXHNoIkGJitJAOw9JD0XToObRaR02Oj4nGP1sU0JiAamJA66W6CGy60enhITCoFFQ+2+c2OfwBQK6mXUdxIdwGjiAA */ initial: 'prompt', states: { prompt: { on: { 'feedback.provide': [ // Taken if 'sentimentGood' guard evaluates to `true` { guard: 'sentimentGood', target: 'thanks', }, // Taken if none of the above guarded transitions are taken // and if 'sentimentBad' guard evaluates to `true` { guard: 'sentimentBad', target: 'form', }, // Default transition { target: 'form' }, ], }, }, thanks: {}, form: {}, }, })
Actual
Expected
No error occurs
Thank you for the report; we're investigating this.
Are you still investigating this ?