diff --git a/src/mixin.js b/src/mixin.js index db2e038e..c26c3136 100644 --- a/src/mixin.js +++ b/src/mixin.js @@ -91,9 +91,11 @@ function launch () { if (key.charAt(0) !== '$') { let options = apollo[key] const smart = this.$apollo.addSmartQuery(key, options) - options = reapply(options, this) - if (options.prefetch !== false && apollo.$prefetch !== false && !smart.skip) { - this.$_apolloPromises.push(smart.firstRun) + if (this.$isServer) { + options = reapply(options, this) + if (options.prefetch !== false && apollo.$prefetch !== false && !smart.skip) { + this.$_apolloPromises.push(smart.firstRun) + } } } } diff --git a/src/smart-query.js b/src/smart-query.js index 3dadb631..97aaea6b 100644 --- a/src/smart-query.js +++ b/src/smart-query.js @@ -24,10 +24,12 @@ export default class SmartQuery extends SmartApollo { super(vm, key, options, false) - this.firstRun = new Promise((resolve, reject) => { - this._firstRunResolve = resolve - this._firstRunReject = reject - }) + if (vm.$isServer) { + this.firstRun = new Promise((resolve, reject) => { + this._firstRunResolve = resolve + this._firstRunReject = reject + }) + } if (this.vm.$isServer) { this.options.fetchPolicy = 'network-only' @@ -291,9 +293,9 @@ export default class SmartQuery extends SmartApollo { } } - firstRunReject () { + firstRunReject (error) { if (this._firstRunReject) { - this._firstRunReject() + this._firstRunReject(error) this._firstRunReject = null } }