fix: $apolloData
This commit is contained in:
+7
-5
@@ -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])
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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`)
|
||||
|
||||
Reference in New Issue
Block a user