Skip to content
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

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

Open
soc221b opened this issue Oct 10, 2023 · 1 comment

Comments

@soc221b
Copy link

soc221b commented Oct 10, 2023

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

@davidkpiano
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants