Skip to content

Commit d6d4da1

Browse files
committed
fix: $apollo null error if smar obj is destroyed but has throttled/debounced calls
1 parent a79b790 commit d6d4da1

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

packages/vue-apollo-option/src/smart-apollo.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export default class SmartApollo {
9898
const queryCb = this.initialOptions[prop].bind(this.vm)
9999
this.options[prop] = queryCb()
100100
let cb = query => {
101+
if (this._destroyed) return
101102
this.options[prop] = query
102103
this.refresh()
103104
}

packages/vue-apollo-option/src/smart-query.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ export default class SmartQuery extends SmartApollo {
9494
}
9595

9696
executeApollo (variables) {
97+
if (this._destroyed) return
98+
9799
const variablesJson = JSON.stringify(variables)
98100

99101
if (this.sub) {

packages/vue-apollo-option/src/smart-subscription.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export default class SmartSubscription extends SmartApollo {
2828
}
2929

3030
executeApollo (variables) {
31+
if (this._destroyed) return
32+
3133
const variablesJson = JSON.stringify(variables)
3234
if (this.sub) {
3335
// do nothing if subscription is already running using exactly the same variables

0 commit comments

Comments
 (0)