statelyai / xstate

Actor-based state management & orchestration for complex app logic.
https://stately.ai/docs
MIT License
27.18k stars 1.26k forks source link

@xstate/vue throws warnings when used with Vite #1940

Closed TheDutchCoder closed 3 years ago

TheDutchCoder commented 3 years ago

Description

When using xstate in components in Vite, the useMachine method throws warnings from the compiler: image

It makes the state machine non-reactive. I'm not sure why this happens...

Expected Result useMachine to not throw warnings and be reactive.

Actual Result Warnings are thrown from the compiler.

Reproduction I don't have a repro ready yet, because it's not very easy to set it up with Vite.

Additional context Vite latest version, xstate and @xstate/vue latest version

Andarist commented 3 years ago

Please always try to share a repro case in a runnable form - either by providing a git repository to clone or a codesandbox. OSS maintainers usually can't afford the time to set up the repro, even if exact steps are given.

TheDutchCoder commented 3 years ago

I understand of course.

On the flip-side, it's sometimes very, very time-consuming to reproduce the exact issue in a "new" environment and sometimes issues are more familiar to maintainers because they've encountered them before and/or they have more in-depth knowledge of their own code.

I'm not unwilling to try and replicate this (I normally do with smaller issues), I just don't always have hours to spend on it either.

TheDutchCoder commented 3 years ago

I can close this issue, as I have tracked down that this is actually a problem with the VitePress dev mode. I isolated it into vue-cli, Vite, and VitePress. And only VitePress in dev mode (not prod) throws these warnings, so something's up over there.

I will make a reproduction and open an issue on their GH, thanks!