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