Repository navigation
fix(@angular/ssr): destroy platform when request is aborted during rendering - #34568
Open
alan-agius4 wants to merge 1 commit into
Open
alan-agius4 wants to merge 1 commit into
alan-agius4 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for aborting the SSR rendering process using an AbortSignal across AngularNodeAppEngine, AngularAppEngine, and AngularServerApp. When a request is aborted, the underlying Angular platform is destroyed to halt any in-progress rendering, and a DOMException with an 'AbortError' is thrown. The feedback suggests introducing an isDestroyed guard flag in renderAngular to prevent redundant platform destruction when destroy() is called multiple times, and simplifying the catch block by reusing this updated destroy() function.
This comment was marked as resolved.
This comment was marked as resolved.
…ndering Previously, aborting `request.signal` during server-side rendering caused `AngularServerApp.handle()` to reject via `promiseWithAbort`, while `renderAngular()` continued running in the background until `whenStable()` completed (or leaked the platform if a pending task never resolved). This commit forwards `request.signal` into `renderAngular()` so that aborting an in-flight request destroys the underlying `PlatformRef`, cancels any pending render timer, and exits cleanly. Additionally, `promiseWithAbort()` now attaches rejection handlers to the underlying promise even when the signal is already aborted to avoid unhandled promise rejections. Closes angular#34567
alan-agius4
force-pushed
the
fix/ssr-abort-destroy-platform
branch
from
October 28, 2026 14:43
d079bbc to
322f09f
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, aborting
request.signalduring server-side rendering causedAngularServerApp.handle()to reject viapromiseWithAbort, whilerenderAngular()continued running in the background untilwhenStable()completed (or leaked the platform if a pending task never resolved).This commit forwards
request.signalintorenderAngular()so that aborting an in-flight request destroys the underlyingPlatformRef, cancels any pending render timer, and exits cleanly. Additionally,promiseWithAbort()now attaches rejection handlers to the underlying promise even when the signal is already aborted to avoid unhandled promise rejections.Closes #34567