fix(smart apollo): ensure SmartQuery variables still function when watched expression evaluated (#1161), closes #991
This commit is contained in:
@@ -112,10 +112,18 @@ export default class SmartApollo {
|
||||
cb = this.options.throttle ? throttle(cb, this.options.throttle) : cb
|
||||
cb = this.options.debounce ? debounce(cb, this.options.debounce) : cb
|
||||
}
|
||||
this._watchers.push(this.vm.$watch(() => this.options.variables.call(this.vm), cb, {
|
||||
immediate: true,
|
||||
deep: this.options.deep,
|
||||
}))
|
||||
this._watchers.push(
|
||||
this.vm.$watch(
|
||||
() => typeof this.options.variables === 'function'
|
||||
? this.options.variables.call(this.vm)
|
||||
: this.options.variables,
|
||||
cb,
|
||||
{
|
||||
immediate: true,
|
||||
deep: this.options.deep,
|
||||
},
|
||||
),
|
||||
)
|
||||
} else {
|
||||
this.executeApollo(this.options.variables)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user