perf(ivy): remove firstTemplatePass check from directive instantiation (#31946)

PR Close #31946
This commit is contained in:
Pawel Kozlowski 2019-08-01 15:30:04 +02:00 committed by Alex Rickabaugh
parent 32e2f4daef
commit aaf29c8099
1 changed files with 5 additions and 5 deletions

View File

@ -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<T>(
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;