refactor(ivy): remove code duplication around root component view creation (#31946)
PR Close #31946
This commit is contained in:
parent
a7c71d1a57
commit
32e2f4daef
|
@ -144,8 +144,6 @@ export function renderComponent<T>(
|
||||||
component = createRootComponent(
|
component = createRootComponent(
|
||||||
componentView, componentDef, rootView, rootContext, opts.hostFeatures || null);
|
componentView, componentDef, rootView, rootContext, opts.hostFeatures || null);
|
||||||
|
|
||||||
addToViewTree(rootView, componentView);
|
|
||||||
|
|
||||||
refreshDescendantViews(rootView); // creation mode pass
|
refreshDescendantViews(rootView); // creation mode pass
|
||||||
rootView[FLAGS] &= ~LViewFlags.CreationMode;
|
rootView[FLAGS] &= ~LViewFlags.CreationMode;
|
||||||
resetPreOrderHookFlags(rootView);
|
resetPreOrderHookFlags(rootView);
|
||||||
|
@ -188,6 +186,8 @@ export function createRootComponentView(
|
||||||
initNodeFlags(tNode, rootView.length, 1);
|
initNodeFlags(tNode, rootView.length, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addToViewTree(rootView, componentView);
|
||||||
|
|
||||||
// Store component view at node index, with node as the HOST
|
// Store component view at node index, with node as the HOST
|
||||||
return rootView[HEADER_OFFSET] = componentView;
|
return rootView[HEADER_OFFSET] = componentView;
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,7 +193,6 @@ export class ComponentFactory<T> extends viewEngine_ComponentFactory<T> {
|
||||||
component = createRootComponent(
|
component = createRootComponent(
|
||||||
componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
|
componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
|
||||||
|
|
||||||
addToViewTree(rootLView, componentView);
|
|
||||||
refreshDescendantViews(rootLView);
|
refreshDescendantViews(rootLView);
|
||||||
safeToRunHooks = true;
|
safeToRunHooks = true;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue