State is not persistent when reopening chrome windows | using Pinia persistent package
Hi there, i'm using pinia for managing global states and used pinia-persistent for persisting the state.
I'm using the default config (That uses the cookie storage), but I'm encountering an issue with the state when closing the window and reopen it, and some times even open new tab, the state resets.
What to do to make the state persistent with a timeout using cookies ?
4 Replies
"There is nothing broken here; Pinia does not by itself persist the state. If that’s the behavior we want, we have to solve for that ourselves. So let’s look at different ways we can solve this problem by persisting our store upon page reloads."
hope this helps https://www.vuemastery.com/blog/refresh-proof-your-pinia-stores/
Vue Mastery
Refresh-proof your Pinia Stores | Vue Mastery
By default, the state in Pinia stores is cleared upon browser refresh. Let’s look at 3 simple solutions for refresh-proofing your Pinia stores.
I'm using the https://prazdevs.github.io/pinia-plugin-persistedstate/ it helps with persisting data.
Home | pinia-plugin-persistedstate
🍍 Configurable persistence and rehydration of Pinia stores.
The issue is not with the refresh but with closing the browser and reopen it later
yeah it might be all part of the same issue. are you using localStorage? if not, then you should