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

Bug: VSCode visualizer doesn't resolve imported variables #490

Open
adrianbw opened this issue Mar 29, 2024 · 3 comments
Open

Bug: VSCode visualizer doesn't resolve imported variables #490

adrianbw opened this issue Mar 29, 2024 · 3 comments

Comments

@adrianbw
Copy link

adrianbw commented Mar 29, 2024

When a state chart includes imported values, the visualizer doesn't seem to be resolving them, which makes the visualizer fail. This makes it really hard to share code across the various parts of our system. Given that the visualizer is a huge selling point, this is probably going to make me recommend not using xstate.

Here's without imports:
without-imports

And with:
with-imports

I've created a reproduction of this issue here: https://github.com/adrianbw/xstate-vscode-import-problem.

@adrianbw
Copy link
Author

I'd be happy to try helping with this, but I'm having trouble getting the repo working with VSCode. If there are directions for that somewhere, I'd appreciate it.

@nikuz
Copy link

nikuz commented Jul 4, 2024

@davidkpiano this is actually a serious problem. I also prefer to keep my states as enums and action types outside of the state description to not bloat the state file. I guess this might be related to how the Stately.ai online editor works - it also expect all the variables defined in one file. But this limitation in VS Code makes it unusable for large projects.

I was going to adapt XState library and showcase the cool state charts to my team but now I can't do it without breaching our code organization guidelines.

@sparachi
Copy link

I have the same issue in our project. I tried to import the states definition from an external file and it did not work. But if states are defined in the demo file inline it works great. The sample project @adrianbw has perfectly sums up the problem.

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

3 participants