Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/wrappers/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,24 @@ export default class Wrapper implements BaseWrapper {
// $FlowIgnore : Problem with possibly null this.vm
this.vm._computedWatchers[key].getter = () => computed[key]
} else {
let isStore = false
// $FlowIgnore : Problem with possibly null this.vm
if (!this.vm._watchers.some(w => w.getter.name === key)) {
const max = this.vm._watchers.length
for (let i = 0; i < max; i++) {
// $FlowIgnore : Problem with possibly null this.vm
const watcher = this.vm._watchers[i]
// $FlowIgnore : Problem with possibly null this.vm
if (watcher.getter.vuex && key in watcher.vm.$options.store.getters) {
watcher.vm.$options.store.getters = {
...watcher.vm.$options.store.getters
}
Object.defineProperty(watcher.vm.$options.store.getters, key, { get: function () { return computed[key] } })
isStore = true
break
}
}
// $FlowIgnore : Problem with possibly null this.vm
if (!isStore && !this.vm._watchers.some(w => w.getter.name === key)) {
throwError(`wrapper.setComputed() was passed a value that does not exist as a computed property on the Vue instance. Property ${key} does not exist on the Vue instance`)
}
// $FlowIgnore : Problem with possibly null this.vm
Expand Down