Seb-L / pinia-plugin-persist

Persist pinia state data in sessionStorage or other storages.
https://Seb-L.github.io/pinia-plugin-persist/
MIT License
215 stars 37 forks source link

Persistence doesn't work well when using multiple pinia stores. #36

Open vannel opened 2 years ago

vannel commented 2 years ago

It works totally fine when there was only ONE pinia store in my application. After I added another pinia definition and it just went weird. It seems that there could be ONLY ONE store that can be persisted into the storage at a time, while others just freeze in the storage, no matter when any actions or $reset being called. And pinia works fine, though. Just the persistence goes wrong.

// authStore.js
const useAuthStore = defineStore("auth", { ... })

// routerStore.js
const useRouterStore = defineStore("router", { ... })

Here are the dependencies in my package.json:

"dependencies": {
   // ......
    "pinia": "^2.0.0-rc.10",
    "pinia-plugin-persist": "^1.0.0",
    "vue": "^3.2.25",
  }
q807175022 commented 2 years ago

I came across the same problem

L1150143576 commented 2 years ago

I came across the same problem

Allen-1998 commented 2 years ago

maybe about this https://github.com/Seb-L/pinia-plugin-persist/pull/39

L1150143576 commented 2 years ago

maybe about this https://github.com/Seb-L/pinia-plugin-persist/pull/38

Jiangg21 commented 2 years ago

I came across the same problem too!