Skip to content

Commit ad406d2

Browse files
author
Brian Chen
authored
Only iterate across active targets in WatchChangeAggregator (#2847)
1 parent 60116ca commit ad406d2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/firestore/src/api/database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2620,7 +2620,7 @@ function applyFirestoreDataConverter<T>(
26202620
return [convertedValue, functionName];
26212621
}
26222622

2623-
function contains(obj: object, key: string): obj is { key : unknown } {
2623+
function contains(obj: object, key: string): obj is { key: unknown } {
26242624
return Object.prototype.hasOwnProperty.call(obj, key);
26252625
}
26262626

packages/firestore/src/remote/watch_change.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,11 @@ export class WatchChangeAggregator {
367367
if (targetChange.targetIds.length > 0) {
368368
targetChange.targetIds.forEach(fn);
369369
} else {
370-
this.targetStates.forEach((_, targetId) => fn(targetId));
370+
this.targetStates.forEach((_, targetId) => {
371+
if (this.isActiveTarget(targetId)) {
372+
fn(targetId);
373+
}
374+
});
371375
}
372376
}
373377

0 commit comments

Comments
 (0)