@@ -606,36 +606,37 @@ export abstract class ApolloCache {
606606 canonicalStringify ( { id, optimistic, variables } ) ,
607607 ] ;
608608 const cacheEntry = this . fragmentWatches . lookupArray ( cacheKey ) ;
609- let currentResult : ApolloCache . WatchFragmentResult < TData > ;
610609
611- function getNewestResult ( diff : Cache . DiffResult < TData > ) {
612- const data = transform ( diff . result ) ;
613-
614- if (
615- ! currentResult ||
616- ! equalByQuery (
617- fragmentQuery ,
618- { data : currentResult . data } ,
619- { data } ,
620- options . variables
621- )
622- ) {
623- currentResult = {
624- data,
625- dataState : diff . complete ? "complete" : "partial" ,
626- complete : diff . complete ,
627- } as ApolloCache . WatchFragmentResult < TData > ;
628-
629- if ( diff . missing ) {
630- currentResult . missing = diff . missing . missing ;
610+ if ( ! cacheEntry . observable ) {
611+ let subscribed = false ;
612+ let currentResult : ApolloCache . WatchFragmentResult < TData > ;
613+
614+ function getNewestResult ( diff : Cache . DiffResult < TData > ) {
615+ const data = transform ( diff . result ) ;
616+
617+ if (
618+ ! currentResult ||
619+ ! equalByQuery (
620+ fragmentQuery ,
621+ { data : currentResult . data } ,
622+ { data } ,
623+ options . variables
624+ )
625+ ) {
626+ currentResult = {
627+ data,
628+ dataState : diff . complete ? "complete" : "partial" ,
629+ complete : diff . complete ,
630+ } as ApolloCache . WatchFragmentResult < TData > ;
631+
632+ if ( diff . missing ) {
633+ currentResult . missing = diff . missing . missing ;
634+ }
631635 }
632- }
633636
634- return currentResult ;
635- }
637+ return currentResult ;
638+ }
636639
637- if ( ! cacheEntry . observable ) {
638- let subscribed = false ;
639640 const observable : Observable < ApolloCache . WatchFragmentResult < TData > > & {
640641 dirty ?: boolean ;
641642 } = new Observable < ApolloCache . WatchFragmentResult < TData > > ( ( observer ) => {
0 commit comments