From 7068a83c3e1bfeea35faac8427dbd136256627ed Mon Sep 17 00:00:00 2001 From: Dominic Garms Date: Tue, 20 Mar 2018 17:46:05 +0800 Subject: [PATCH 1/2] relax getter on loading --- src/smart-query.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/smart-query.js b/src/smart-query.js index b96ef5df..19a9d721 100644 --- a/src/smart-query.js +++ b/src/smart-query.js @@ -30,7 +30,7 @@ export default class SmartQuery extends SmartApollo { } get loading () { - return this.vm.$data.$apolloData ? this.vm.$data.$apolloData.queries[this.key].loading : this._loading + return this.vm.$data.$apolloData && this.vm.$data.$apolloData.queries[this.key] ? this.vm.$data.$apolloData.queries[this.key].loading : this._loading } set loading (value) { From dbcdaf5f7023c963be88859ad80381445cbb7778 Mon Sep 17 00:00:00 2001 From: Dominic Garms Date: Wed, 21 Mar 2018 13:46:42 +0800 Subject: [PATCH 2/2] fix setter as well --- src/smart-query.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/smart-query.js b/src/smart-query.js index 19a9d721..d676e82e 100644 --- a/src/smart-query.js +++ b/src/smart-query.js @@ -36,7 +36,7 @@ export default class SmartQuery extends SmartApollo { set loading (value) { if (this._loading !== value) { this._loading = value - if (this.vm.$data.$apolloData) { + if (this.vm.$data.$apolloData && this.vm.$data.$apolloData.queries[this.key]) { this.vm.$data.$apolloData.queries[this.key].loading = value this.vm.$data.$apolloData.loading += value ? 1 : -1 }