vuejs / vuex

🗃️ Centralized State Management for Vue.js.
https://vuex.vuejs.org
MIT License
28.4k stars 9.56k forks source link

The getter is updated, but the associated dom is not updated. #2217

Open codeZoon opened 1 year ago

codeZoon commented 1 year ago

Version

"vuex": "^4.1.0"

Describe the bug

After registering the module dynamically, devtool shows that the state and getters are recomputed, but the getter-related views are not updated.

Reproduction

` / /src/store/index.ts / import { createStore } from "vuex";

export const store = createStore({ state() { return { count: 0 } },

getters: { double(state) { return state.count * 2; } },

mutations: { increment(state, num) { state.count += num; }, decrement(state, num) { state.count -= num; } } }); `

` / /src/main.ts / import { createApp } from 'vue'; import App from './App.vue'; import { store } from './store';

createApp(App).use(store).mount('#app'); `

` / /src/App.vue /

`

Expected behavior

The view associated with the getter should be updated.

Additional context

No response

Validations

codeZoon commented 1 year ago

1680140646373

codeZoon commented 1 year ago

1680141362810

cristiancananau commented 1 year ago

have the same Issue. Is there any solution ?

weier910 commented 1 year ago

你的邮件我已收到!

ahovbok commented 1 year ago

@codeZoon and @cananaucristian, you could downgrade to version 4.0.2. I just checked, and dynamic module registration works fine on this version.

cristiancananau commented 1 year ago

@ahovbok thank you, i have done that already but i want the issue to be fixed and i want to know why is that not working.

wolf991 commented 1 year ago

I think i have a similar problem, not sure, since it's in a big project, and I haven't really bothered to reproduce it in a smaller scale. A workaround i found that works for my scenario, is to use a function in the getter then it works. Again, not sure, if it's the same issue. And even if the workaround works, it would be nice if this would be fixed.

Super-Chama commented 11 months ago

I'm facing the same issue in 4.1.0 but in my project this happens randomly so its much annoying. hopefully we'll get a fix