Skip to content

Commit

Permalink
fix(cdk/testing): prevent duplicate subscription (#22460)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bgotink authored Apr 13, 2021
1 parent 30ea79a commit 58b4ab6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cdk/testing/change-detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function batchChangeDetection<T>(fn: () => Promise<T>, triggerBeforeAndAft

// If nothing is handling change detection batching, install the default handler.
if (!autoChangeDetectionSubscription) {
autoChangeDetectionSubject.subscribe(defaultAutoChangeDetectionHandler);
handleAutoChangeDetectionStatus(defaultAutoChangeDetectionHandler);
}

if (triggerBeforeAndAfter) {
Expand Down

0 comments on commit 58b4ab6

Please sign in to comment.