Skip to content

fix(@angular/ssr): destroy platform when response stream is cancelled - #33802

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-ssr-stream-cancel-cleanup
Aug 7, 2026
Merged

fix(@angular/ssr): destroy platform when response stream is cancelled#33802
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-ssr-stream-cancel-cleanup

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Ensures PlatformRef is properly destroyed when an active response stream is cancelled or encounters an error during rendering to prevent memory leaks.

@alan-agius4 alan-agius4 closed this Aug 7, 2026
@alan-agius4 alan-agius4 reopened this Aug 7, 2026
@alan-agius4
alan-agius4 force-pushed the fix-ssr-stream-cancel-cleanup branch from b677ace to 1d0f4f3 Compare August 7, 2026 14:24
@alan-agius4
alan-agius4 marked this pull request as ready for review August 7, 2026 14:25
@alan-agius4
alan-agius4 requested a review from clydin August 7, 2026 14:25
@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces robust error handling and resource cleanup for the Angular SSR response stream. It wraps the stream's start method in a try-catch block, handles stream cancellation by destroying the rendering result, and exposes a destroy callback from renderAngular to clean up the platform reference. The reviewer suggested adding a unit test to verify that the platform is properly destroyed when the response stream is cancelled, providing a code snippet for the test.

Comment thread packages/angular/ssr/src/app.ts
@alan-agius4
alan-agius4 force-pushed the fix-ssr-stream-cancel-cleanup branch from 1d0f4f3 to bd73ca5 Compare August 7, 2026 14:28
Ensures PlatformRef is properly destroyed when an active response stream is cancelled or encounters an error during rendering to prevent memory leaks.
@alan-agius4
alan-agius4 force-pushed the fix-ssr-stream-cancel-cleanup branch from bd73ca5 to 413feed Compare August 7, 2026 14:30
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 7, 2026
@alan-agius4
alan-agius4 merged commit 6a34467 into angular:main Aug 7, 2026
39 of 40 checks passed
@alan-agius4
alan-agius4 deleted the fix-ssr-stream-cancel-cleanup branch August 7, 2026 15:18
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

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: @angular/ssr target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants