Skip to content

Fix build #287

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

Merged
merged 1 commit into from
Dec 22, 2017
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