angular/packages/platform-server
Sonu Kapoor 1aeebbe304 fix(core): respect ngSkipHydration on components with projectable nodes in LContainers
When a component is created dynamically via ViewContainerRef.createComponent
and receives projectable nodes (e.g. raw DOM nodes or embedded view root nodes),
applying ngSkipHydration to its host element did not prevent NG0503 from being
thrown during SSR serialization.

The root cause is an asymmetry in the serialization pipeline. For inline child
components, serializeLView already guards the annotateHostElementForHydration
call with a ngSkipHydration attribute check, so the component's lView is never
serialized when hydration is opted out. For components hosted inside an
LContainer (created via ViewContainerRef.createComponent), serializeLContainer
called serializeLView unconditionally — bypassing that guard entirely. When
serializeLView then encountered a projection slot backed by a raw DOM node
array, it threw NG0503 regardless of the ngSkipHydration flag.

The fix adds the same guard inside serializeLContainer before calling
serializeLView: if the child lView belongs to a component whose host element
carries ngSkipHydration, the lView serialization is skipped. This matches the
existing behavior for inline components and allows the documented workaround to
actually work for dynamically created ones.

Fixes #67928

(cherry picked from commit 4c9afb68a3)
2026-04-29 23:09:18 +00:00
..
init build: consolidate domino bundling in platform-server 2026-03-25 13:31:10 -07:00
src docs: update documentation for platform server URL token options 2026-04-29 20:37:04 +00:00
test fix(core): respect ngSkipHydration on components with projectable nodes in LContainers 2026-04-29 23:09:18 +00:00
testing build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
third_party/domino build: consolidate domino bundling in platform-server 2026-03-25 13:31:10 -07:00
BUILD.bazel build: consolidate domino bundling in platform-server 2026-03-25 13:31:10 -07:00
index.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
package.json fix(core): update min Node.js support to 20.19, 22.12, and 24.0 (#61499) 2025-05-20 14:15:13 +00:00
PACKAGE.md docs: drop glossary links (#55044) 2024-03-28 13:02:50 -07:00
public_api.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00