@@ -405,46 +405,36 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`);
405
405
combinedOptions ,
406
406
NetworkStatus . fetchMore ,
407
407
) . then ( fetchMoreResult => {
408
-
409
408
this . queryManager . removeQuery ( qid ) ;
410
409
411
410
if ( queryInfo . networkStatus === NetworkStatus . fetchMore ) {
412
411
queryInfo . networkStatus = originalNetworkStatus ;
413
412
}
414
413
415
- // Performing this cache update inside a cache.batch transaction ensures
416
- // any affected cache.watch watchers are notified about the updates. Most
417
- // watchers will be using the QueryInfo class, which responds to
418
- // notifications by calling reobserveCacheFirst to deliver fetchMore cache
419
- // results back to this ObservableQuery.
420
- this . queryManager . cache . batch ( {
421
- update : cache => {
422
- const { updateQuery } = fetchMoreOptions ;
423
- if ( updateQuery ) {
424
- cache . updateQuery ( {
425
- query : this . options . query ,
426
- variables : this . variables ,
427
- returnPartialData : true ,
428
- optimistic : false ,
429
- } , previous => updateQuery ( previous ! , {
430
- fetchMoreResult : fetchMoreResult . data ,
431
- variables : combinedOptions . variables as TFetchVars ,
432
- } ) ) ;
433
-
434
- } else {
435
- // If we're using a field policy instead of updateQuery, the only
436
- // thing we need to do is write the new data to the cache using
437
- // combinedOptions.variables (instead of this.variables, which is
438
- // what this.updateQuery uses, because it works by abusing the
439
- // original field value, keyed by the original variables).
440
- cache . writeQuery ( {
441
- query : combinedOptions . query ,
442
- variables : combinedOptions . variables ,
443
- data : fetchMoreResult . data ,
444
- } ) ;
445
- }
446
- } ,
447
- } ) ;
414
+ const { updateQuery } = fetchMoreOptions ;
415
+ if ( updateQuery ) {
416
+ this . queryManager . cache . updateQuery ( {
417
+ query : this . options . query ,
418
+ variables : this . variables ,
419
+ returnPartialData : true ,
420
+ optimistic : false ,
421
+ } , previous => updateQuery ( previous ! , {
422
+ fetchMoreResult : fetchMoreResult . data ,
423
+ variables : combinedOptions . variables as TFetchVars ,
424
+ } ) ) ;
425
+
426
+ } else {
427
+ // If we're using a field policy instead of updateQuery, the only
428
+ // thing we need to do is write the new data to the cache using
429
+ // combinedOptions.variables (instead of this.variables, which is
430
+ // what this.updateQuery uses, because it works by abusing the
431
+ // original field value, keyed by the original variables).
432
+ this . queryManager . cache . writeQuery ( {
433
+ query : combinedOptions . query ,
434
+ variables : combinedOptions . variables ,
435
+ data : fetchMoreResult . data ,
436
+ } ) ;
437
+ }
448
438
449
439
return fetchMoreResult as ApolloQueryResult < TFetchData > ;
450
440
} ) ;
0 commit comments