Skip to content

Dynamic components aren't hydrated when root component is used as an anchor #51157

@devknoll

Description

@devknoll

Which @angular/* package(s) are the source of the bug?

platform-browser

Is this a regression?

No

Description

As in the linked reproduction, I'm dynamically creating a component like so:

import('./foo/foo.component').then((m) => {
  this.vcr.createComponent(m.FooComponent);
});

The component correctly appears in the SSR output. However, Angular does not appear to hydrate the component. Instead, it creates a new instance, and leaves the existing copy in the DOM dehydrated (and thus, broken), even after hydration completes.

Please provide a link to a minimal reproduction of the bug

https://codesandbox.io/p/sandbox/unruffled-dawn-dngll7

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

No response

Anything else?

No response

Metadata

Metadata

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimecore: hydrationstate: has PR

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions