prazdevs / pinia-plugin-persistedstate

🍍 Configurable persistence and rehydration of Pinia stores.
https://prazdevs.github.io/pinia-plugin-persistedstate/
MIT License
1.91k stars 106 forks source link

default storage to persistedState.localStorage #304

Open u007 opened 1 month ago

u007 commented 1 month ago

Clear and concise description of the problem

by default persists: true -> using sessionStorage, upon refresh, its gone

Suggested solution

suggest default storage to persistedState.localStorage

Alternative

No response

Additional context

No response

Validations

prazdevs commented 1 month ago

Hi, the default with Nuxt is actually cookies as it is an SSR friendly solution. localStorage and sessionStorage are client-only which may end up in hydration mismatches and unexpected behaviours with Nuxt's default SSR setting :)

u007 commented 1 month ago

hi. nice but i realised using cookies store does not work, my store become empty

GreyXor commented 1 week ago

Hi, the default with Nuxt is actually cookies as it is an SSR friendly solution. localStorage and sessionStorage are client-only which may end up in hydration mismatches and unexpected behaviours with Nuxt's default SSR setting :)

Really ? but doc says that default is localStorage : https://prazdevs.github.io/pinia-plugin-persistedstate/guide/config.html#storage

prazdevs commented 1 week ago

Not for Nuxt https://prazdevs.github.io/pinia-plugin-persistedstate/frameworks/nuxt-3.html#choosing-a-storage :)

u007 commented 1 week ago

do you have a vike plugin?