From 1b06b3c424a7d754aa3a118da4e391f239d5a377 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 11 Oct 2019 18:06:24 -0400 Subject: [PATCH] perf: avoid parentNode call when dynamic child is not a Fragment --- packages/runtime-core/src/createRenderer.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/createRenderer.ts b/packages/runtime-core/src/createRenderer.ts index 2c836071..595b187c 100644 --- a/packages/runtime-core/src/createRenderer.ts +++ b/packages/runtime-core/src/createRenderer.ts @@ -503,7 +503,11 @@ export function createRenderer< patch( oldVNode, dynamicChildren[i], - hostParentNode(oldVNode.el!)!, + // in the case of a Fragment, we need to provide the actual parent + // of the Fragment itself so it can move its children. In other cases, + // the parent container is not actually used so we just pass the + // block element here to avoid a DOM parentNode call. + oldVNode.type === Fragment ? hostParentNode(oldVNode.el!)! : el, null, parentComponent, parentSuspense,