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

Cannot load a machine inside a file which contains decorator syntax #21

Open
BrunoUY opened this issue Oct 12, 2021 · 4 comments
Open

Comments

@BrunoUY
Copy link

BrunoUY commented Oct 12, 2021

Hi, I can´t open a machine defined inside a .tsx file; it's possible?

I'm using stencilJS and the components get the .tsx extension

thanks!

@mattpocock
Copy link
Contributor

Could you make a reproduction? I can load them from within .tsx files fine locally. What version are you on?

@BrunoUY
Copy link
Author

BrunoUY commented Oct 12, 2021

Hi, I uploaded it here

https://github.com/BrunoUY/test-xstate-visualizer

I'm trying to open it in https://github.com/BrunoUY/test-xstate-visualizer/blob/master/src/components/app-payment-form/app-payment-form.tsx

line 5

as the "open inspector" text don´t appear I used the command "XState: open inspector" and I got the message "could not find a machine at the current cursor"

I put another machine on https://github.com/BrunoUY/test-xstate-visualizer/blob/master/src/helpers/promise-machine.ts and this one got the "open inspector" button on the editor without a problem

@mattpocock
Copy link
Contributor

Thanks - looks legit, I tested it and it fails. It looks like it doesn't like the decorator syntax used there, which is annoying because I've fixed that before.

For now, define your machine in a separate file to the decorator syntax and it'll work.

@mattpocock mattpocock changed the title load machine inside .tsx file? Cannot load a machine inside a file which contains decorator syntax Oct 12, 2021
@viglucci
Copy link

Adding an additional data point where I just had the same issue inside a nestjs project where decorators are common. Had to comment out the decorators for the extension to identify the machine.

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