From aaf29c8099f376ebf8020f4c462b587f32f8f9e3 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Thu, 1 Aug 2019 15:30:04 +0200 Subject: [PATCH] perf(ivy): remove firstTemplatePass check from directive instantiation (#31946) PR Close #31946 --- packages/core/src/render3/instructions/shared.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/src/render3/instructions/shared.ts b/packages/core/src/render3/instructions/shared.ts index 1fe39d904b..20ae3f196f 100644 --- a/packages/core/src/render3/instructions/shared.ts +++ b/packages/core/src/render3/instructions/shared.ts @@ -1030,7 +1030,7 @@ export function resolveDirectives( localRefs: string[] | null): void { // Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in // tsickle. - ngDevMode && assertEqual(tView.firstTemplatePass, true, 'should run on first template pass only'); + ngDevMode && assertFirstTemplatePass(tView); if (!getBindingsEnabled()) return; @@ -1062,6 +1062,10 @@ export function resolveDirectives( 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 // any projected components. registerPreOrderHooks( @@ -1171,10 +1175,6 @@ function postProcessDirective( setInputsFromAttrs(directiveDefIdx, directive, def, previousOrParentTNode); } - if (viewData[TVIEW].firstTemplatePass && def.contentQueries) { - previousOrParentTNode.flags |= TNodeFlags.hasContentQuery; - } - if (isComponentDef(def)) { const componentView = getComponentViewByIndex(previousOrParentTNode.index, viewData); componentView[CONTEXT] = directive;