Skip to content

Commit 58b4ab6

Browse files
authored
fix(cdk/testing): prevent duplicate subscription (#22460)
If the actual subscription provided by the environment comes after the first batched function call, the default function is installed and without this change it'll stay installed forever, even if another handler is installed afterwards.
1 parent 30ea79a commit 58b4ab6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cdk/testing/change-detection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async function batchChangeDetection<T>(fn: () => Promise<T>, triggerBeforeAndAft
6969

7070
// If nothing is handling change detection batching, install the default handler.
7171
if (!autoChangeDetectionSubscription) {
72-
autoChangeDetectionSubject.subscribe(defaultAutoChangeDetectionHandler);
72+
handleAutoChangeDetectionStatus(defaultAutoChangeDetectionHandler);
7373
}
7474

7575
if (triggerBeforeAndAfter) {

0 commit comments

Comments
 (0)