Skip to content

fix(core): reuse a shared abort reason when aborting resource loads - #71423

Open
lazerg wants to merge 1 commit into
angular:mainfrom
lazerg:fix/issue-71422-resource-abort-reason
Open

lazerg wants to merge 1 commit into
angular:mainfrom
lazerg:fix/issue-71422-resource-abort-reason

Conversation

@lazerg

@lazerg lazerg commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

PR Type

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other

What is the current behavior?

ResourceImpl keeps its AbortController after a load resolves and calls abort() with no reason when the resource is destroyed. Without a reason, every call creates a new AbortError DOMException and captures a stack trace, which gets expensive deep inside the view destroy recursion when a page with many resources is torn down.

Issue Number: #71422

What is the new behavior?

Loads are aborted with one shared AbortError, created lazily the first time it is needed. Loaders that forward the signal (for example to fetch) still see an AbortError as the reason.

Does this PR introduce a breaking change?

  • Yes
  • No

Calling `abort()` without a reason creates a new `AbortError` with a stack
trace on every call, which adds up when many resources are destroyed at once.

Fixes angular#71422
@pullapprove
pullapprove Bot requested a review from crisbeto October 19, 2026 06:11
@angular-robot angular-robot Bot added the area: core Issues related to the framework runtime label Oct 19, 2026
@ngbot ngbot Bot added this to the Backlog milestone Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues related to the framework runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant