Skip to content

Commit 622489d

Browse files
committed
Fix errors
1 parent e469da6 commit 622489d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/firestore/src/core/firestore_client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,9 @@ function readDocumentViaSnapshotListener(
656656
): Promise<void> {
657657
const wrappedObserver = new AsyncObserver({
658658
next: (snap: ViewSnapshot) => {
659+
// No further messages should be processed.
660+
wrappedObserver.mute();
661+
659662
// Remove query first before passing event to user to avoid
660663
// user actions affecting the now stale query.
661664
asyncQueue.enqueueAndForget(() =>
@@ -754,6 +757,9 @@ function executeQueryViaSnapshotListener(
754757
): Promise<void> {
755758
const wrappedObserver = new AsyncObserver<ViewSnapshot>({
756759
next: snapshot => {
760+
// No further messages should be processed.
761+
wrappedObserver.mute();
762+
757763
// Remove query first before passing event to user to avoid
758764
// user actions affecting the now stale query.
759765
asyncQueue.enqueueAndForget(() =>

packages/firestore/test/integration/api/bundle.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ apiDescribe('Bundles', persistence => {
202202
await setDoc(doc(db, 'coll-1/b'), { k: 'b', bar: 0 });
203203

204204
const accumulator = new EventsAccumulator<QuerySnapshot>();
205-
onSnapshot(collection(db, 'coll-1'), accumulator.storeEvent);
205+
const unsubscribe = onSnapshot(collection(db, 'coll-1'), accumulator.storeEvent);
206206
await accumulator.awaitEvent();
207207

208208
const progress = await loadBundle(
@@ -216,6 +216,7 @@ apiDescribe('Bundles', persistence => {
216216
// generated as a result. The case where a bundle has newer doc than
217217
// cache can only be tested in spec tests.
218218
await accumulator.assertNoAdditionalEvents();
219+
unsubscribe();
219220

220221
let snap = await getDocs((await namedQuery(db, 'limit'))!);
221222
expect(toDataArray(snap)).to.deep.equal([{ k: 'b', bar: 0 }]);

0 commit comments

Comments
 (0)