Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: Avoid handling promise rejections twice in stability helper
`PendingTasks.run` reports rejections of the promise to the
`ErrorHandler`. This function already returns a promise that is meant to
be handled in the developer's application. If there _is_ handling there,
the rejection is handled both in the `PendingTasks.run` and in the
developer callsite.

This change updates the code to use `PendingTasks.add` instead, which
has no built in error handling mechanisms.

fixes angular/angular#61932
  • Loading branch information
atscott committed Jun 6, 2025
commit 695d4c5f81cc8af2ec243e6a685e1ce5c41fbaaa
4 changes: 2 additions & 2 deletions src/zones.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ export const ɵzoneWrap = <T= unknown>(it: T, blockUntilFirst: boolean, logLevel
// eslint-disable-next-line @typescript-eslint/no-misused-promises
return run(
() => {
pendingTasks.run(() => ret);
const removeTask = pendingTasks.add();
return new Promise((resolve, reject) => {
ret.then(
(it) => runInInjectionContext(injector, () => run(() => resolve(it))),
(reason) => runInInjectionContext(injector, () => run(() => reject(reason)))
)
).finally(removeTask);
});
});
} else if (typeof ret === 'function' && taskDone) {
Expand Down