Repository navigation
Conversation
Previously, `then()` recorded only `Zone.current`, and every promise reaction in the process is drained from one shared microtask. Each reaction, the task hooks around it and the reporting of its errors ran in the async context of whatever scheduled that microtask, so on the server `AsyncLocalStorage.getStore()` could return the store of another request. Since `NgZone` runs change detection from those hooks, a whole tick could run as the wrong request. Capture the async context when the callback is registered and run the task inside it, as Node.js recommends for custom thenables. Set `__Zone_disable_asyncContext` to opt out. Fixes angular#71825
SkyZeroZx
force-pushed
the
fix-zone-als
branch
from
November 5, 2026 02:21
1bc58d9 to
0e36a87
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
then()recorded onlyZone.current, and every promise reaction in the process is drained from one shared microtask. Each reaction, the task hooks around it and the reporting of its errors ran in the async context of whatever scheduled that microtask, so on the serverAsyncLocalStorage.getStore()could return the store of another request. SinceNgZoneruns change detection from those hooks, a whole tick could run as the wrong request.Capture the async context when the callback is registered and run the task inside it, as Node.js recommends for custom thenables. Set
__Zone_disable_asyncContextto opt out.Fixes #71825