diff --git a/packages/vue-apollo/src/smart-apollo.js b/packages/vue-apollo/src/smart-apollo.js index 80114c86..4ca1235e 100644 --- a/packages/vue-apollo/src/smart-apollo.js +++ b/packages/vue-apollo/src/smart-apollo.js @@ -112,10 +112,19 @@ 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) }