Comments (3)
Aight, I looked into it, sounds good to me.
Since data is serialized to be persisted in local storage (or any StorageLike), we indeed lose references when we recreate them.
The hook solution sounds like a good idea to work around this problem, as well as extending the API with an interesting feature.
I'll merge it and eventually change couple things in the tests to isolate them more and add to the docs.
Really appreciate the contribution! I'll release a new version ASAP so you can use it in your projects.
from pinia-plugin-persistedstate.
@prazdevs I made a pull request for this (#12) implementing the above example and also a beforeRestore
hook.
I tested it in my project and it works perfectly to restore reactivity ✌🏽
from pinia-plugin-persistedstate.
Awesome thanks 🙏🏽
from pinia-plugin-persistedstate.
Related Issues (20)
- Add support for setup stores HOT 1
- 我开启了 strict 但是使用 defineStore 时,依然返回any HOT 3
- 多个store数据持久化到同一个key下支持吗? HOT 2
- Nuxt 3 setup-store not persisting data HOT 2
- Support use with Composable Pinia stores HOT 6
- Is navigator.storage.persist() supported? HOT 1
- 持久化状态可以自定义时间 HOT 1
- 执行了$hydrate并没有从存储里面恢复数据
- update to @pinia/[email protected] HOT 3
- Application crashes when cookies are disabled
- Opt-in/out persistent cookies HOT 1
- Store lost after a page refresh HOT 1
- [core] Watch localstorage for changes from other tabs HOT 5
- How do I get persisted state as a cookie in my Nuxt 3 server HOT 3
- How to import "persistedState" in Nuxt 3? HOT 5
- Setting store values in succession breaks cookie persistence ?? HOT 3
- Programaticaly Prevent Hydration HOT 1
- Cookie warning on Nuxt 3 when I set persist to `true` HOT 1
- Persistance not working on latest Nuxt 3 project HOT 3
- Dynamic class binding not working as expected with Session Storage HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pinia-plugin-persistedstate.