]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
perf: skip props update if data object is the same
authorEvan You <yyx990803@gmail.com>
Sun, 28 Oct 2018 19:58:59 +0000 (15:58 -0400)
committerEvan You <yyx990803@gmail.com>
Sun, 28 Oct 2018 19:58:59 +0000 (15:58 -0400)
packages/runtime-core/src/createRenderer.ts

index 354450d959099a65c53eb77375b11362337311e6..e16424f656040c5be209e44785b5c5c509688708 100644 (file)
@@ -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