-
-
Notifications
You must be signed in to change notification settings - Fork 979
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
Reactivity loss when using pinia with @vue/compat #2565
Comments
this isn’t directly related to pinia, some extra configuration in the bundles is likely needed so vue-demi also resolves. I think you should be able to fix this by also aliasing to whatever vue-demi imports from |
You're right. I managed to reproduce this without pinia. I'll open issue in vue-demi repo because it's not clear to me how to configure it and I think it would be nice to have this in official docs somewhere. Thanks! |
If you think this should be documented, since you probably already went through some of the documentation to use |
I'm still trying to figure out the fix but I'm not very well versed in vite configuration. Once I have something working I'll make sure to open PR to vue docs. |
Reproduction
https://github.com/bgoscinski/repro-vue-compat-reactivity/tree/4c0097057ad00d1316dd354700c4d13c3d209592
Steps to reproduce the bug
npm install
npm test
. Both tests fail'vue': '@vue/compat'
alias from./vite.config.js
npm test
again. Both tests pass 🤯Expected behavior
Reactivity is preserved when using pinia with
@vue/compat
Actual behavior
No/broken reactivity
Additional information
I think that pinia doesn't use the reactivity primitives from @vue/compat so we end up with both of these loaded at the same time:
Because of that the component's render effect is not tracking all reactive values properly.
I'm not sure where exactly the root cause of the problem is - is it in pinia, vue-demi, vitest, vite or @vue/compat so please advise if this is the wrong repo for this issue :)
The text was updated successfully, but these errors were encountered: