angular/packages/core
Alex Rickabaugh b592b1b051 fix(core): fix race condition in resource() (#59851)
The refactoring of `resource()` to use `linkedSignal()` introduced the
potential for a race condition where resources would get stuck and not update
in response to a request change. This occurred under a specific condition:

1. The request changes while the resource is still in loading state
2. The resource resolves the previous load before its `effect()` reacts to the
   request change.

In practice, the window for this race is small, because the request change in
(1) will schedule the effect in (2) immediately. However, it's easier to
trigger this sequencing in tests, especially when one resource depends on the
output of another.

To fix the race condition, the resource impl is refactored to track the request
in its state, and ignore resolved values or streams for stale requests. This
refactoring actually makes the resource code simpler and easier to follow as
well.

Fixes #59842

PR Close #59851
2025-02-05 15:01:02 -08:00
..
global refactor(docs-infra): use interpolation instead of innerHTML for better perf (#58913) 2024-11-27 10:59:18 +01:00
primitives fix(platform-browser): Update pseudoevent created by createMouseSpecialEvent to populate _originalEvent property (#59690) 2025-01-27 10:28:58 +01:00
rxjs-interop fix(core): fix race condition in resource() (#59851) 2025-02-05 15:01:02 -08:00
schematics fix(migrations): avoid applying the same replacements twice when cleaning up unused imports (#59656) 2025-01-22 07:57:38 -08:00
src fix(core): fix race condition in resource() (#59851) 2025-02-05 15:01:02 -08:00
test fix(core): fix race condition in resource() (#59851) 2025-02-05 15:01:02 -08:00
testing refactor: replace ɵPendingTasks with ɵPendingTasksInternal (#59138) 2024-12-10 13:45:07 -08:00
BUILD.bazel refactor(platform-server): Add an ssr benchmark setup. (#57647) 2024-10-04 10:45:22 -07:00
index.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
package.json build: update zone.js peer dependency for core package to 0.15.0 (#57431) 2024-08-21 13:17:52 -07:00
PACKAGE.md docs: add package doc files (#26047) 2018-10-05 15:42:14 -07:00
public_api.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00