Skip to content

Reactivity loss when using with @vue/compatΒ #253

@bgoscinski

Description

@bgoscinski

Reproduction

https://github.com/bgoscinski/repro-vue-compat-reactivity

Steps to reproduce the bug

  1. Run npm install
  2. Run npm test. Test fails
  3. Remove 'vue': '@vue/compat' alias from ./vite.config.js
  4. Run npm test again. Test passes 🀯

Expected behavior

Reactivity is preserved when using vue-demi with @vue/compat

Actual behavior

No/broken reactivity

Additional information

I think that vue-demi doesn't use the reactivity primitives from @vue/compat so we end up with both of these loaded at the same time:

  • node_modules/@vue/compat/dist/vue.cjs.js
  • node_modules/@vue/reactivity/dist/reactivity.cjs.js

Because of that the component's render effect is not tracking all reactive values properly.

I'm coming from vuejs/pinia#2565 but it's still not clear for me how to properly configure aliases and I think it would be beneficial for the whole ecosystem to have this documented somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions