statelyai / xstate-tools

Public monorepo for XState tooling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

soc221b opened this issue · comments

Version

xstate@5.0.0-beta.33
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

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