fix: compatibility with vuex4: no changing of store data outside of mutations#308
fix: compatibility with vuex4: no changing of store data outside of mutations#308
Conversation
…utations And show that this is needed if the vuex store is in strict mode.
| const promise: SerializablePromise<StoreData<StoreType>> = loadStoreData || Promise.resolve(store.state[opts.apiName][uri]) | ||
| promise.toJSON = () => '{}' // avoid warning in Nuxt when serializing the complete Vuex store ("Cannot stringify arbitrary non-POJOs Promise") | ||
| store.state[opts.apiName][uri]._meta.load = promise | ||
| store.commit('setLoadPromise', { |
There was a problem hiding this comment.
Have you read the comment on line 399? I think I had to do it this way, otherwise I would run into problems... Change LGTM, but I'm unsure because of that comment
There was a problem hiding this comment.
Yep, somehow the comment is here again, deleted it in some somewhere along they way, now its here again..
Nice that the comment is there, but i don't know what the problems were then, i did not find any hints in the commit which added the comment, no tests broke...
I tried it against a ecamp3 with vue3 with a strict store, but i had not enough substance to test it. (We don't have any interactivity except the login which works yet...)
But with this change you can login, you can at least fetch some data without setting the store to strict:false.
And as you can see if you check out the change: if you set the store to strict, this change is needed.
If you can remember what the problem was then i am eager to hear it... else we will find this problem again if its still there.
And show that this is needed if the vuex store is in strict mode.