Skip to content

fix(core): cancel obsolete resource loads when params become unavailable - #71766

Merged
thePunderWoman merged 1 commit into
angular:mainfrom
shoutoutuoadi325:fix/resource-cancel-unavailable-params
Nov 11, 2026
Merged

thePunderWoman merged 1 commit into
angular:mainfrom
shoutoutuoadi325:fix/resource-cancel-unavailable-params

Conversation

@shoutoutuoadi325

Copy link
Copy Markdown
Contributor

PR Checklist

  • The commit message follows the guidelines
  • Tests for the changes have been added
  • Docs have been added / updated (this restores the existing documented cancellation behavior; no public API changes)

PR Type

  • Bugfix

What is the current behavior?

When params return undefined, propagate ResourceParamsStatus.IDLE/LOADING, or throw an error during a pending load, loadEffect() returns before cancelling the obsolete loader. The resource changes status, but the old AbortSignal stays active and its pending task can block application stability indefinitely.

Fixes #71765.

What is the new behavior?

Cancel the previous load before checking whether the new request can run. Unavailable params now abort obsolete work and release its pending task, including when the old loader never settles.

Add six regressions covering undefined params, propagated statuses/errors, recovery, and late resolution/rejection after a new load starts. The latter checks that old completions neither replace the new state nor release the new load's pending task.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Validation:

  • pnpm bazel test //packages/core/test/resource:resource — all 76 specs pass. With the original implementation, the new stability regressions time out.
  • pnpm lint — passes, including formatting checks.
  • pnpm bazel test //packages/... — 792 of 796 test targets pass. The four failures also reproduce with the original implementation: the two common browser suites have timezone-dependent DatePipe/formatDate expectations; perform_compile fails its inherited compiler-options cache invalidation test; Firefox WebMCP depends on suite order because only provide_tools_spec.ts overrides originAgentCluster. The Firefox failure reproduces on the original source with JASMINE_RANDOM_SEED=71267.

Cancel previous loads before returning for unavailable or errored resource
params. These transitions otherwise leave the old AbortSignal active and
keep its pending task blocking application stability.

Preserve pending-task ownership when cancelled promises settle after a new
request starts. Cover unavailable params, propagated statuses and errors,
and late resolution or rejection in regression tests.
@pullapprove
pullapprove Bot requested a review from atscott November 2, 2026 08:58
@angular-robot angular-robot Bot added the area: core Issues related to the framework runtime label Nov 2, 2026
@ngbot ngbot Bot added this to the Backlog milestone Nov 2, 2026
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Nov 10, 2026
@JeanMeche
JeanMeche removed the request for review from atscott November 10, 2026 23:43
@JeanMeche JeanMeche added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Nov 10, 2026
@thePunderWoman
thePunderWoman merged commit efbab16 into angular:main Nov 11, 2026
28 of 30 checks passed
@thePunderWoman

Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resource: obsolete loads keep the application unstable when params become unavailable

3 participants