perf: skip props update if data object is the same

This commit is contained in:
Evan You 2018-10-28 15:58:59 -04:00
parent c9b33a9e69
commit d8cda2387f

View File

@ -468,7 +468,7 @@ export function createRenderer(options: RendererOptions) {
} }
function patchStatefulComponent(prevVNode: MountedVNode, nextVNode: VNode) { function patchStatefulComponent(prevVNode: MountedVNode, nextVNode: VNode) {
const { childFlags: prevChildFlags } = prevVNode const { data: prevData, childFlags: prevChildFlags } = prevVNode
const { const {
data: nextData, data: nextData,
slots: nextSlots, slots: nextSlots,
@ -481,7 +481,9 @@ export function createRenderer(options: RendererOptions) {
instance.$parentVNode = nextVNode as MountedVNode instance.$parentVNode = nextVNode as MountedVNode
// Update props. This will trigger child update if necessary. // 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, // If has different slots content, or has non-compiled slots,
// the child needs to be force updated. It's ok to call $forceUpdate // the child needs to be force updated. It's ok to call $forceUpdate