mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
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 |
||
|---|---|---|
| .. | ||
| BUILD.bazel | ||
| dom_utils.ts | ||
| event_replay_spec.ts | ||
| full_app_hydration_spec.ts | ||
| hydration_utils.ts | ||
| incremental_hydration_spec.ts | ||
| integration_spec.ts | ||
| platform_location_spec.ts | ||
| render_spec.ts | ||
| transfer_state_spec.ts | ||