Skip to content

Store is not reactive in Vue 2 #1772

@Graphmaxer

Description

@Graphmaxer

Environment

With Vue 2.7.16 and pinia-orm 1.7.2

Reproduction

Not working with pinia-orm 1.7.2 and vue 2: https://stackblitz.com/edit/vue2-vite-starter-yrebbd
Working with pinia-orm 1.6.7 and vue 2: https://stackblitz.com/edit/vue2-vite-starter-a2jqrw
Working with pinia-orm 1.7.2 and vue 3: https://stackblitz.com/edit/vue2-vite-starter-jn2ym2

Describe the bug

When using Vue 2, Object.assign is breaking reactivity. When an entity is inserted into a repository, the getter using the repository are not updated.

Additional context

It is possible to verify that the pinia store state is changed via https://pinia.vuejs.org/core-concepts/state.html#Subscribing-to-the-state With Vue 2, we can see that the inner store state is not properly updated via the Object.assign used in pinia-orm 1.7

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvue2Releated to Vue2

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions