$patch function replace value in remote object #1921
-
Reproductionhttps://github.com/mathias22osterhagen22/vuejs-pinia-patch-issue.git Steps to reproduce the bug
Expected behavior
Actual behavior
Additional informationPatching "TEST" updating the state + the object values passed as ref: This seems to happened because the pinia/packages/pinia/src/store.ts Line 83 in 78ec9a1 I met this issue because of the Local storage "loading" (with the plugin https://github.com/prazdevs/pinia-plugin-persistedstate) I'm storing an Enum object in the state, stored in the local storage. On page reload the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Assigning an object to a different variable/object property does not make a copy. it just makes a new reference to the same object, so changing one changes the "other" as well. That's just how JS works. |
Beta Was this translation helpful? Give feedback.
Assigning an object to a different variable/object property does not make a copy. it just makes a new reference to the same object, so changing one changes the "other" as well.
That's just how JS works.