-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
The getter is updated, but the associated dom is not updated. #2217
Comments
have the same Issue. Is there any solution ? |
你的邮件我已收到!
|
@codeZoon and @cananaucristian, you could downgrade to version 4.0.2. I just checked, and dynamic module registration works fine on this version. |
@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. |
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. |
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 |
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');
`
`
<script setup lang="ts"> import { computed } from '@vue/reactivity'; import { useStore } from 'vuex'; const store = useStore(); const count = computed(() => { return store.state.count; }); const double = computed(() => { return store.getters.double; }); function increment() { store.commit('increment', 1); } function decrement() { store.commit('decrement', 1); } function registerModule(name: string) { const module = { state() { return {} } }; store.registerModule(name, module); } </script>/* /src/App.vue */
- count: {{ count }} => double: {{ double }} +
register module
`Expected behavior
The view associated with the getter should be updated.
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: