diff --git a/packages/core/src/render3/component.ts b/packages/core/src/render3/component.ts index 8d380e3c74..1c4d9f2319 100644 --- a/packages/core/src/render3/component.ts +++ b/packages/core/src/render3/component.ts @@ -144,8 +144,6 @@ export function renderComponent( component = createRootComponent( componentView, componentDef, rootView, rootContext, opts.hostFeatures || null); - addToViewTree(rootView, componentView); - refreshDescendantViews(rootView); // creation mode pass rootView[FLAGS] &= ~LViewFlags.CreationMode; resetPreOrderHookFlags(rootView); @@ -188,6 +186,8 @@ export function createRootComponentView( initNodeFlags(tNode, rootView.length, 1); } + addToViewTree(rootView, componentView); + // Store component view at node index, with node as the HOST return rootView[HEADER_OFFSET] = componentView; } diff --git a/packages/core/src/render3/component_ref.ts b/packages/core/src/render3/component_ref.ts index c049428499..2f0bebd813 100644 --- a/packages/core/src/render3/component_ref.ts +++ b/packages/core/src/render3/component_ref.ts @@ -193,7 +193,6 @@ export class ComponentFactory extends viewEngine_ComponentFactory { component = createRootComponent( componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]); - addToViewTree(rootLView, componentView); refreshDescendantViews(rootLView); safeToRunHooks = true; } finally {