You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
Thanks for making this plugin! It's simple and useful.
One thing I noticed when using it was that I couldn't use reactive() objects in the state, because the reactivity breaks when the state syncs with the storage:
Because Object.assign() only does a shallow copy, nested reactive objects get overwritten as plain objects. I think to support a deep syncing of the state, you'd have to loop through the state entries itself and call Object.assign() on each one (if it's in the filter list), or it's possible that Pinia's built-in Patch mechanism may do the same thing: https://pinia.vuejs.org/core-concepts/state.html#replacing-the-state
Happy to submit a PR if you think either of these approaches make sense.
The text was updated successfully, but these errors were encountered:
Sorry I took time to answer: I was looked out my GitHub account due to 2FA issues.
It's a really good point. Helper function $patch() seems to be the solution, don't you think? If you're happy with it, I can do it on my side. I'll use the opportunity to update some dependencies!
Thanks for making this plugin! It's simple and useful.
One thing I noticed when using it was that I couldn't use
reactive()
objects in the state, because the reactivity breaks when the state syncs with the storage:https://github.com/BreizhReloaded/unstorage-pinia-plugin/blob/master/src/plugin.ts#L7
Because
Object.assign()
only does a shallow copy, nested reactive objects get overwritten as plain objects. I think to support a deep syncing of the state, you'd have to loop through the state entries itself and callObject.assign()
on each one (if it's in the filter list), or it's possible that Pinia's built-in Patch mechanism may do the same thing: https://pinia.vuejs.org/core-concepts/state.html#replacing-the-stateHappy to submit a PR if you think either of these approaches make sense.
The text was updated successfully, but these errors were encountered: