Skip to content
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

fix: compatibility with vuex4: no changing of store data outside of mutations #290

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from

Conversation

usu
Copy link
Member

@usu usu commented Jan 20, 2024

Otherwise this will throw an console error in vuex.
Haven't seen any negative side effects so far, but we should observe carefully.

+ running linter

@@ -406,7 +406,11 @@ function HalJsonVuex (store: Store<Record<string, State>>, axios: AxiosInstance,
function setLoadPromiseOnStore (uri: string, loadStoreData: Promise<StoreData> | null = null) {
const promise: SerializablePromise<StoreData> = 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', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you read the comment on line 399? I think I had to do it thisway, otherwise I would run into problems... Change LGTM, but I'm unsure because of that comment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the structure and the comment, i think this should probably only be done once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants