xstate-tools icon indicating copy to clipboard operation
xstate-tools copied to clipboard

XState VSCode extension - Visual Editor shows unexpected errors when using multiple guarded transitions

Open soc221b opened this issue 2 years ago • 2 comments

Version

[email protected] XState VSCode v2.0.0

Reproduce

  1. Go to https://stately.ai/docs/guards#multiple-guarded-transitions, there is an example for multiple guarded transitions.
  2. 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

image

Expected

No error occurs

soc221b avatar Oct 10 '23 05:10 soc221b

Thank you for the report; we're investigating this.

davidkpiano avatar Oct 12 '23 10:10 davidkpiano

Are you still investigating this ?

kucukkanat avatar Nov 20 '24 20:11 kucukkanat