From d8cda2387f716fb7eb90dd50b65e6acac11484ff Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 28 Oct 2018 15:58:59 -0400 Subject: [PATCH] perf: skip props update if data object is the same --- packages/runtime-core/src/createRenderer.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/runtime-core/src/createRenderer.ts b/packages/runtime-core/src/createRenderer.ts index 354450d9..e16424f6 100644 --- a/packages/runtime-core/src/createRenderer.ts +++ b/packages/runtime-core/src/createRenderer.ts @@ -468,7 +468,7 @@ export function createRenderer(options: RendererOptions) { } function patchStatefulComponent(prevVNode: MountedVNode, nextVNode: VNode) { - const { childFlags: prevChildFlags } = prevVNode + const { data: prevData, childFlags: prevChildFlags } = prevVNode const { data: nextData, slots: nextSlots, @@ -481,7 +481,9 @@ export function createRenderer(options: RendererOptions) { instance.$parentVNode = nextVNode as MountedVNode // Update props. This will trigger child update if necessary. - updateProps(instance, nextData) + if (nextData !== prevData) { + updateProps(instance, nextData) + } // If has different slots content, or has non-compiled slots, // the child needs to be force updated. It's ok to call $forceUpdate