fix: $apollo null error if smar obj is destroyed but has throttled/debounced calls

This commit is contained in:
Guillaume Chau
2022-05-02 16:32:53 +02:00
parent a79b7908f6
commit d6d4da16d5
3 changed files with 5 additions and 0 deletions
@@ -98,6 +98,7 @@ export default class SmartApollo {
const queryCb = this.initialOptions[prop].bind(this.vm)
this.options[prop] = queryCb()
let cb = query => {
if (this._destroyed) return
this.options[prop] = query
this.refresh()
}
@@ -94,6 +94,8 @@ export default class SmartQuery extends SmartApollo {
}
executeApollo (variables) {
if (this._destroyed) return
const variablesJson = JSON.stringify(variables)
if (this.sub) {
@@ -28,6 +28,8 @@ export default class SmartSubscription extends SmartApollo {
}
executeApollo (variables) {
if (this._destroyed) return
const variablesJson = JSON.stringify(variables)
if (this.sub) {
// do nothing if subscription is already running using exactly the same variables