Skip to content

feat(core): implement Angular Hydration within Document Fragments#67830

Draft
thePunderWoman wants to merge 3 commits intoangular:mainfrom
thePunderWoman:fix-destructive-hydration-20260324
Draft

feat(core): implement Angular Hydration within Document Fragments#67830
thePunderWoman wants to merge 3 commits intoangular:mainfrom
thePunderWoman:fix-destructive-hydration-20260324

Conversation

@thePunderWoman
Copy link
Contributor

Resolves #67785. Introduces withHydrationBoundary API and renderApplicationParts API to support Astro Islands and non-destructive fragment hydration.

Introduces a new withHydrationBoundary feature config for provideClientHydration.
This allows explicitly configuring the DOM regions that Angular hydration should
operate within, replacing the hardcoded document.body default. This is primarily
intended for Astro islands and document fragments where Angular does not own the
entire document payload.

Updates internal core querying mechanisms like verifySsrContentsIntegrity,
gatherDeferBlocksCommentNodes, and gatherDeferBlocksByJSActionAttribute to
respect the configured boundary elements or selectors.
Introduces renderApplicationParts as a new headless rendering API alongside
the existing renderApplication. This provides structural outputs containing
separated <head> and <body> HTML segments, reducing the need for
meta-frameworks (like Astro) to perform brittle string regex extraction
from monolithic <!DOCTYPE html> payloads.

This API complements the new withHydrationBoundary feature config on the
client for hydration in Astro islands and document fragments.
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: core Issues related to the framework runtime area: server Issues related to server-side rendering labels Mar 24, 2026
@ngbot ngbot bot added this to the Backlog milestone Mar 24, 2026
@thePunderWoman thePunderWoman force-pushed the fix-destructive-hydration-20260324 branch 3 times, most recently from 4ff27b4 to dcb06c6 Compare March 24, 2026 21:05
…okup

This addresses the failure of the prior commit validation by properly isolating the boundary defaults within core without importing the DOCUMENT token from common.
@thePunderWoman thePunderWoman force-pushed the fix-destructive-hydration-20260324 branch from dcb06c6 to 8736bb8 Compare March 24, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues related to the framework runtime area: server Issues related to server-side rendering detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSR/Prerendering + Hydration for document fragments

1 participant