File tree 1 file changed +15
-3
lines changed
packages/firestore/src/local 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -702,10 +702,22 @@ export class LocalStore {
702
702
queryData != null ,
703
703
'Tried to release nonexistent query: ' + query
704
704
) ;
705
- this . localViewReferences . removeReferencesForId ( queryData ! . targetId ) ;
706
- delete this . targetIds [ queryData ! . targetId ] ;
705
+
706
+ const targetId = queryData . targetId ;
707
+ const memoryQueryData = this . targetIds [ targetId ] ;
708
+
709
+ this . localViewReferences . removeReferencesForId ( targetId ) ;
710
+ delete this . targetIds [ targetId ] ;
707
711
if ( this . garbageCollector . isEager ) {
708
- return this . queryCache . removeQueryData ( txn , queryData ! ) ;
712
+ return this . queryCache . removeQueryData ( txn , queryData ) ;
713
+ } else if (
714
+ memoryQueryData . snapshotVersion > queryData . snapshotVersion
715
+ ) {
716
+ // If we've been avoiding persisting the resumeToken (see
717
+ // shouldPersistResumeToken for conditions and rationale) we need to
718
+ // persist the token now because there will no longer be an
719
+ // in-memory version to fall back on.
720
+ return this . queryCache . updateQueryData ( txn , memoryQueryData ) ;
709
721
} else {
710
722
return PersistencePromise . resolve ( ) ;
711
723
}
You can’t perform that action at this time.
0 commit comments