diff --git a/src/index.js b/src/index.js index 3252fbb..c16b763 100644 --- a/src/index.js +++ b/src/index.js @@ -40,11 +40,13 @@ const launch = function launch () { // watchQuery for (let key in apollo) { if (key.charAt(0) !== '$') { - Object.defineProperty(this, key, { - get: () => this.$apolloData.data[key], - enumerable: true, - configurable: true, - }) + if (!this.hasOwnProperty(key) && !this.$props.hasOwnProperty(key) && !this.$data.hasOwnProperty(key)) { + Object.defineProperty(this, key, { + get: () => this.$data.$apolloData.data[key], + enumerable: true, + configurable: true, + }) + } this.$apollo.addSmartQuery(key, apollo[key]) } } diff --git a/src/smart-query.js b/src/smart-query.js index 32ac0a3..8e47439 100644 --- a/src/smart-query.js +++ b/src/smart-query.js @@ -105,11 +105,11 @@ export default class SmartQuery extends SmartApollo { // No result } else if (!this.options.manual) { if (typeof this.options.update === 'function') { - this.vm.$set(this.vm.$apolloData.data, this.key, this.options.update.call(this.vm, data)) + this.vm.$set(this.vm.$data.$apolloData.data, this.key, this.options.update.call(this.vm, data)) } else if (data[this.key] === undefined) { console.error(`Missing ${this.key} attribute on result`, data) } else { - this.vm.$set(this.vm.$apolloData.data, this.key, data[this.key]) + this.vm.$set(this.vm.$data.$apolloData.data, this.key, data[this.key]) } } else if (!hasResultCallback) { console.error(`${this.key} query must have a 'result' hook in manual mode`)