From 430124a0512c81712b0ba4f485d670ce11854f2f Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Thu, 25 Jul 2019 10:44:41 +0200 Subject: [PATCH] perf(ivy): only refresh child components if those are defined in a given view (#31839) PR Close #31839 --- packages/core/src/render3/instructions/shared.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/core/src/render3/instructions/shared.ts b/packages/core/src/render3/instructions/shared.ts index 4d13221b2c..b0439ebfd2 100644 --- a/packages/core/src/render3/instructions/shared.ts +++ b/packages/core/src/render3/instructions/shared.ts @@ -107,7 +107,10 @@ export function refreshDescendantViews(lView: LView) { executeViewQueryFn(RenderFlags.Update, tView, lView[CONTEXT]); } - refreshChildComponents(lView, tView.components); + const components = tView.components; + if (components !== null) { + refreshChildComponents(lView, components); + } } @@ -183,11 +186,9 @@ function refreshContentQueries(tView: TView, lView: LView): void { } /** Refreshes child components in the current view. */ -function refreshChildComponents(hostLView: LView, components: number[] | null): void { - if (components != null) { - for (let i = 0; i < components.length; i++) { - componentRefresh(hostLView, components[i]); - } +function refreshChildComponents(hostLView: LView, components: number[]): void { + for (let i = 0; i < components.length; i++) { + componentRefresh(hostLView, components[i]); } }