-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrating from pinia-plugin-persistedstate-2 #274
Comments
The plugin only supports synchronous storages to match pinia's mutation system. This is indeed one of the limitation. |
Can you suggest a migration path for users coming from the abandoned -2 version then? |
Oh yeah, I'm aware, I was just wondering if you have a suggestion for a replacement path, I'll look at actions but that looked like I have to have those defined for every store instead of globally, thanks! |
Would be cool if you could do something like this: pinia.use(
createPersistedState({
actions: {
getItem: async (key) => {
return getStore(key);
},
setItem: async (key, value) => {
return setStore(key, value);
},
removeItem: async (key) => {
return deleteStore(key);
},
},
}),
); |
Due to the way the plugin behaves and how pinia handles it, synchronozing data from async sources is out of the scope of the plugin. My advice would be to have calls done on app startup then calling stores to update the data. That would be the safest way without risking race conditions having async calls in sync functions. Closing this 😌 |
Describe the bug
I'm currently migrating my app from pinia-plugin-persistedstate-2 to this version since it is no longer maintained. I use it inside of an Electron app and have ipc functions mapped to store methods:
and it complains that
Is that what is mentioned on https://prazdevs.github.io/pinia-plugin-persistedstate/guide/limitations.html?
Reproduction
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: