-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Deepmerge breaks modules not related to persist #216
Comments
Can you make a sample github repo with a small contrivied example that faces this issue. I would really love to checkout on my machine and actually debug this properly. |
@championswimmer - https://github.com/Magiczne/vuex-persist-bug-poc Click the button and it will fail spectacularly: Comment line 40 in the src/store/index.ts and it's working completely fine. |
I'm facing this issue too.! Can we have an option to do this without deepmerge? |
I have ended up writing this functionality on my own in the projects I'm using it with, caues it looks that library is somehow abandoned. I also couldn't find any reason besides #64 why lodash was replaced when it was working perfectly fine. |
I have a similar issue. import Vuex from 'vuex';
import VuexPersistence from 'vuex-persist';
const store = new Vuex.Store({
state: {
// Expected empty Map, but actually object
map: new Map(),
set: new Set(),
},
});
const persist = new VuexPersistence({
storage: window.localStorage,
reducer: (state) => ({ map: state.map }),
}).plugin(store); This is caused by the behavior of merging object by deepmerge, which replaced lodash.merge from 3.x. I think another library like just-extend or something should be used. just-extend is a zero-dependency package, so its bundle size is tiny. |
After updating to vuex-persist 3.1.3 modules that are not related in any way to vuex-persist plugin are broken when they're using classes as a part of state. Also i'm using vuex-module-decorators.
For example:
On the application start it throw an error that
foo.bar()
is not a function. It would make sense when the module would be loaded byvuex-persist
but it it not so it should be not touched.Everything worked fine when the backend besides merging was handled by lodash. Everything broke after moving to deepmerge.
What it the solution to this? Temporarily we're using older version but that's not a good option for a long time.
The text was updated successfully, but these errors were encountered: