perf(ivy): remove firstTemplatePass check from directive instantiation (#31946)
PR Close #31946
This commit is contained in:
parent
32e2f4daef
commit
aaf29c8099
@ -1030,7 +1030,7 @@ export function resolveDirectives(
|
|||||||
localRefs: string[] | null): void {
|
localRefs: string[] | null): void {
|
||||||
// Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in
|
// Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in
|
||||||
// tsickle.
|
// tsickle.
|
||||||
ngDevMode && assertEqual(tView.firstTemplatePass, true, 'should run on first template pass only');
|
ngDevMode && assertFirstTemplatePass(tView);
|
||||||
|
|
||||||
if (!getBindingsEnabled()) return;
|
if (!getBindingsEnabled()) return;
|
||||||
|
|
||||||
@ -1062,6 +1062,10 @@ export function resolveDirectives(
|
|||||||
|
|
||||||
saveNameToExportMap(tView.data !.length - 1, def, exportsMap);
|
saveNameToExportMap(tView.data !.length - 1, def, exportsMap);
|
||||||
|
|
||||||
|
if (def.contentQueries) {
|
||||||
|
tNode.flags |= TNodeFlags.hasContentQuery;
|
||||||
|
}
|
||||||
|
|
||||||
// Init hooks are queued now so ngOnInit is called in host components before
|
// Init hooks are queued now so ngOnInit is called in host components before
|
||||||
// any projected components.
|
// any projected components.
|
||||||
registerPreOrderHooks(
|
registerPreOrderHooks(
|
||||||
@ -1171,10 +1175,6 @@ function postProcessDirective<T>(
|
|||||||
setInputsFromAttrs(directiveDefIdx, directive, def, previousOrParentTNode);
|
setInputsFromAttrs(directiveDefIdx, directive, def, previousOrParentTNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewData[TVIEW].firstTemplatePass && def.contentQueries) {
|
|
||||||
previousOrParentTNode.flags |= TNodeFlags.hasContentQuery;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isComponentDef(def)) {
|
if (isComponentDef(def)) {
|
||||||
const componentView = getComponentViewByIndex(previousOrParentTNode.index, viewData);
|
const componentView = getComponentViewByIndex(previousOrParentTNode.index, viewData);
|
||||||
componentView[CONTEXT] = directive;
|
componentView[CONTEXT] = directive;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user