Skip to content

Commit 80c8fe0

Browse files
author
Guillaume Chau
committed
fix: $apolloData
1 parent 05bb9fe commit 80c8fe0

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ const launch = function launch () {
4040
// watchQuery
4141
for (let key in apollo) {
4242
if (key.charAt(0) !== '$') {
43-
Object.defineProperty(this, key, {
44-
get: () => this.$apolloData.data[key],
45-
enumerable: true,
46-
configurable: true,
47-
})
43+
if (!this.hasOwnProperty(key) && !this.$props.hasOwnProperty(key) && !this.$data.hasOwnProperty(key)) {
44+
Object.defineProperty(this, key, {
45+
get: () => this.$data.$apolloData.data[key],
46+
enumerable: true,
47+
configurable: true,
48+
})
49+
}
4850
this.$apollo.addSmartQuery(key, apollo[key])
4951
}
5052
}

src/smart-query.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ export default class SmartQuery extends SmartApollo {
105105
// No result
106106
} else if (!this.options.manual) {
107107
if (typeof this.options.update === 'function') {
108-
this.vm.$set(this.vm.$apolloData.data, this.key, this.options.update.call(this.vm, data))
108+
this.vm.$set(this.vm.$data.$apolloData.data, this.key, this.options.update.call(this.vm, data))
109109
} else if (data[this.key] === undefined) {
110110
console.error(`Missing ${this.key} attribute on result`, data)
111111
} else {
112-
this.vm.$set(this.vm.$apolloData.data, this.key, data[this.key])
112+
this.vm.$set(this.vm.$data.$apolloData.data, this.key, data[this.key])
113113
}
114114
} else if (!hasResultCallback) {
115115
console.error(`${this.key} query must have a 'result' hook in manual mode`)

0 commit comments

Comments
 (0)