Skip to content

Commit 6ce8ed4

Browse files
committed
Relax individual document revert constraints
1 parent 448c522 commit 6ce8ed4

File tree

1 file changed

+7
-34
lines changed

1 file changed

+7
-34
lines changed

packages/firestore/src/local/local_store.ts

+7-34
Original file line numberDiff line numberDiff line change
@@ -458,40 +458,6 @@ export class LocalStore {
458458
}
459459
);
460460

461-
let changedDocKeys = documentKeySet();
462-
remoteEvent.documentUpdates.forEach((key, doc) => {
463-
changedDocKeys = changedDocKeys.add(key);
464-
promises.push(
465-
documentBuffer.getEntry(txn, key).next(existingDoc => {
466-
// Make sure we don't apply an old document version to the remote
467-
// cache, though we make an exception for SnapshotVersion.MIN which
468-
// can happen for manufactured events (e.g. in the case of a limbo
469-
// document resolution failing).
470-
if (
471-
existingDoc == null ||
472-
doc.version.isEqual(SnapshotVersion.MIN) ||
473-
doc.version.compareTo(existingDoc.version) >= 0
474-
) {
475-
documentBuffer.addEntry(doc);
476-
} else {
477-
log.debug(
478-
LOG_TAG,
479-
'Ignoring outdated watch update for ',
480-
key,
481-
'. Current version:',
482-
existingDoc.version,
483-
' Watch version:',
484-
doc.version
485-
);
486-
}
487-
488-
// The document might be garbage because it was unreferenced by
489-
// everything. Make sure to mark it as garbage if it is...
490-
this.garbageCollector.addPotentialGarbageKey(key);
491-
})
492-
);
493-
});
494-
495461
// HACK: The only reason we allow a null snapshot version is so that we
496462
// can synthesize remote events when we get permission denied errors while
497463
// trying to resolve the state of a locally cached document that is in
@@ -511,6 +477,13 @@ export class LocalStore {
511477
);
512478
}
513479

480+
let changedDocKeys = documentKeySet();
481+
remoteEvent.documentUpdates.forEach((key, doc) => {
482+
changedDocKeys = changedDocKeys.add(key);
483+
documentBuffer.addEntry(doc);
484+
this.garbageCollector.addPotentialGarbageKey(key);
485+
});
486+
514487
let releasedWriteKeys: DocumentKeySet;
515488
return PersistencePromise.waitFor(promises)
516489
.next(() => this.releaseHeldBatchResults(txn, documentBuffer))

0 commit comments

Comments
 (0)