robinvdvleuten / vuex-persistedstate

💾 Persist and rehydrate your Vuex state between page reloads.
https://npm.im/vuex-persistedstate
MIT License
5.77k stars 378 forks source link

Document that functions are stripped from objects and not restored #353

Open cyberco opened 4 years ago

cyberco commented 4 years ago

Since objects are stored using JSON.stringify functions are stripped off. They're lost when the object is restored. This basically blocks the option of storing class instances (or other objects with functions) in vuex. Although I think you built a nice library this should be mentioned in the main README.md

Harm-Nullix commented 3 years ago

If I may reference: https://github.com/vuejs/vuex/issues/757#issuecomment-297668640 Save your classes/methods in code and hydrate them with the data from the store.

Serializable is the key word here