3.1.1
https://codesandbox.io/s/vue-template-bms46
Just go to the "Link to minimal reproduction" and focus on App.vue where I have:
computed: {
...mapGetters("module", {
user: "person"
})
},
watch: {
user: {
handler(user) {
console.log(user);
},
deep: true
}
},
Having the computed and watcher properties should work fine..
However, the watcher seems to cause an issue and the user getter becomes undefined and in the console you see the error:
[vuex] module namespace not found in mapGetters()
If you remove the user watcher everything works normally.
How can the watcher affect the mapGetter ???
How about doing it this way:
https://codesandbox.io/embed/vue-template-2yex5
@changavila the problem is that I am using namespaced modules.
You should register the module in beforeCreate hook as created hook is triggered after computed properties are initialized.
@changavila the problem is that I am using namespaced modules.
Oh, right, Sorry.
Most helpful comment
You should register the module in
beforeCreatehook ascreatedhook is triggered after computed properties are initialized.