@@ -364,6 +364,7 @@ function debounce (delay, atBegin, callback) {
364364}
365365
366366var index_esm = /*#__PURE__*/ Object . freeze ( {
367+ __proto__ : null ,
367368 throttle : throttle ,
368369 debounce : debounce
369370} ) ;
@@ -520,8 +521,10 @@ function () {
520521 _this . refresh ( ) ;
521522 } ;
522523
523- _cb = _this . options . throttle ? utils_2 ( _cb , _this . options . throttle ) : _cb ;
524- _cb = _this . options . debounce ? utils_3 ( _cb , _this . options . debounce ) : _cb ;
524+ if ( ! _this . vm . $isServer ) {
525+ _cb = _this . options . throttle ? utils_2 ( _cb , _this . options . throttle ) : _cb ;
526+ _cb = _this . options . debounce ? utils_3 ( _cb , _this . options . debounce ) : _cb ;
527+ }
525528
526529 _this . _watchers . push ( _this . vm . $watch ( queryCb , _cb , {
527530 deep : _this . options . deep
@@ -536,8 +539,11 @@ function () {
536539
537540 if ( typeof this . options . variables === 'function' ) {
538541 var cb = this . executeApollo . bind ( this ) ;
539- cb = this . options . throttle ? utils_2 ( cb , this . options . throttle ) : cb ;
540- cb = this . options . debounce ? utils_3 ( cb , this . options . debounce ) : cb ;
542+
543+ if ( ! this . vm . $isServer ) {
544+ cb = this . options . throttle ? utils_2 ( cb , this . options . throttle ) : cb ;
545+ cb = this . options . debounce ? utils_3 ( cb , this . options . debounce ) : cb ;
546+ }
541547
542548 this . _watchers . push ( this . vm . $watch ( function ( ) {
543549 return _this . options . variables . call ( _this . vm ) ;
@@ -749,15 +755,7 @@ function (_SmartApollo) {
749755
750756 _classCallCheck ( this , SmartQuery ) ;
751757
752- // Simple query
753- if ( ! options . query ) {
754- var query = options ;
755- options = {
756- query : query
757- } ;
758- } // Add reactive data related to the query
759-
760-
758+ // Add reactive data related to the query
761759 if ( vm . $data . $apolloData && ! vm . $data . $apolloData . queries [ key ] ) {
762760 vm . $set ( vm . $data . $apolloData . queries , key , {
763761 loading : false
@@ -772,6 +770,8 @@ function (_SmartApollo) {
772770
773771 _defineProperty ( _assertThisInitialized ( _this ) , "_loading" , false ) ;
774772
773+ _defineProperty ( _assertThisInitialized ( _this ) , "_linkedSubscriptions" , [ ] ) ;
774+
775775 if ( vm . $isServer ) {
776776 _this . firstRun = new Promise ( function ( resolve , reject ) {
777777 _this . _firstRunResolve = resolve ;
@@ -834,7 +834,31 @@ function (_SmartApollo) {
834834 return ;
835835 }
836836
837- this . sub . unsubscribe ( ) ;
837+ this . sub . unsubscribe ( ) ; // Subscribe to more subs
838+
839+ var _iteratorNormalCompletion = true ;
840+ var _didIteratorError = false ;
841+ var _iteratorError = undefined ;
842+
843+ try {
844+ for ( var _iterator = this . _linkedSubscriptions [ Symbol . iterator ] ( ) , _step ; ! ( _iteratorNormalCompletion = ( _step = _iterator . next ( ) ) . done ) ; _iteratorNormalCompletion = true ) {
845+ var sub = _step . value ;
846+ sub . stop ( ) ;
847+ }
848+ } catch ( err ) {
849+ _didIteratorError = true ;
850+ _iteratorError = err ;
851+ } finally {
852+ try {
853+ if ( ! _iteratorNormalCompletion && _iterator [ "return" ] != null ) {
854+ _iterator [ "return" ] ( ) ;
855+ }
856+ } finally {
857+ if ( _didIteratorError ) {
858+ throw _iteratorError ;
859+ }
860+ }
861+ }
838862 }
839863
840864 this . previousVariablesJson = variablesJson ; // Create observer
@@ -850,7 +874,33 @@ function (_SmartApollo) {
850874 }
851875 }
852876
853- _get ( _getPrototypeOf ( SmartQuery . prototype ) , "executeApollo" , this ) . call ( this , variables ) ;
877+ _get ( _getPrototypeOf ( SmartQuery . prototype ) , "executeApollo" , this ) . call ( this , variables ) ; // Subscribe to more subs
878+
879+
880+ var _iteratorNormalCompletion2 = true ;
881+ var _didIteratorError2 = false ;
882+ var _iteratorError2 = undefined ;
883+
884+ try {
885+ for ( var _iterator2 = this . _linkedSubscriptions [ Symbol . iterator ] ( ) , _step2 ; ! ( _iteratorNormalCompletion2 = ( _step2 = _iterator2 . next ( ) ) . done ) ; _iteratorNormalCompletion2 = true ) {
886+ var _sub = _step2 . value ;
887+
888+ _sub . start ( ) ;
889+ }
890+ } catch ( err ) {
891+ _didIteratorError2 = true ;
892+ _iteratorError2 = err ;
893+ } finally {
894+ try {
895+ if ( ! _iteratorNormalCompletion2 && _iterator2 [ "return" ] != null ) {
896+ _iterator2 [ "return" ] ( ) ;
897+ }
898+ } finally {
899+ if ( _didIteratorError2 ) {
900+ throw _iteratorError2 ;
901+ }
902+ }
903+ }
854904 }
855905 } , {
856906 key : "startQuerySubscription" ,
@@ -1313,17 +1363,25 @@ function () {
13131363 value : function addSmartQuery ( key , options ) {
13141364 var _this3 = this ;
13151365
1316- var finalOptions = utils_5 ( options , this . vm ) ;
1366+ var finalOptions = utils_5 ( options , this . vm ) ; // Simple query
1367+
1368+ if ( ! finalOptions . query ) {
1369+ var query = finalOptions ;
1370+ finalOptions = {
1371+ query : query
1372+ } ;
1373+ }
1374+
13171375 var apollo = this . vm . $options . apollo ;
13181376 var defaultOptions = this . provider . defaultOptions ;
13191377 var $query ;
13201378
1321- if ( apollo && apollo . $query ) {
1322- $query = apollo . $query ;
1379+ if ( defaultOptions && defaultOptions . $query ) {
1380+ $query = defaultOptions . $query ;
13231381 }
13241382
1325- if ( ( ! apollo || ! apollo . $query ) && defaultOptions && defaultOptions . $query ) {
1326- $query = defaultOptions . $query ;
1383+ if ( apollo && apollo . $query ) {
1384+ $query = _objectSpread2 ( { } , $query || { } , { } , apollo . $query ) ;
13271385 }
13281386
13291387 if ( $query ) {
@@ -1368,6 +1426,11 @@ function () {
13681426 options = utils_5 ( options , this . vm ) ;
13691427 var smart = this . subscriptions [ key ] = new SmartSubscription ( this . vm , key , options , false ) ;
13701428 smart . autostart ( ) ;
1429+
1430+ if ( options . linkedQuery ) {
1431+ options . linkedQuery . _linkedSubscriptions . push ( smart ) ;
1432+ }
1433+
13711434 return smart ;
13721435 }
13731436 }
@@ -1476,7 +1539,11 @@ function () {
14761539 }
14771540
14781541 this . clients = options . clients || { } ;
1479- this . clients . defaultClient = this . defaultClient = options . defaultClient ;
1542+
1543+ if ( options . defaultClient ) {
1544+ this . clients . defaultClient = this . defaultClient = options . defaultClient ;
1545+ }
1546+
14801547 this . defaultOptions = options . defaultOptions ;
14811548 this . watchLoading = options . watchLoading ;
14821549 this . errorHandler = options . errorHandler ;
@@ -2073,7 +2140,7 @@ function install(Vue, options) {
20732140}
20742141ApolloProvider . install = install ; // eslint-disable-next-line no-undef
20752142
2076- ApolloProvider . version = "3.0.0-rc.6 " ; // Apollo provider
2143+ ApolloProvider . version = "3.0.0-rc.7 " ; // Apollo provider
20772144
20782145var ApolloProvider$1 = ApolloProvider ; // Components
20792146
0 commit comments