diff --git a/src/runtime/instance/render.js b/src/runtime/instance/render.js index dd77b8a6..77aa547f 100644 --- a/src/runtime/instance/render.js +++ b/src/runtime/instance/render.js @@ -55,13 +55,14 @@ export function renderMixin (Vue) { this.$options._renderChildren = children // update props and listeners if (parentData) { + updateEvents(this, parentData, oldParentData) // if any prop has changed it would trigger and queue an update, // but if no props changed, nothing happens - updateProps(this, parentData) - updateEvents(this, parentData, oldParentData) + const propsChanged = updateProps(this, parentData) // diff parent data (attrs on the placeholder) and queue update - // if anything changed - if (parentDataChanged(parentData, oldParentData)) { + // if anything changed. only do this if props didn't change, because + // if props changed then an update has already been queued. + if (!propsChanged && parentDataChanged(parentData, oldParentData)) { this.$forceUpdate() } } @@ -213,15 +214,22 @@ function mergeParentData (vm, data, parentData) { } function updateProps (vm, data) { + let changed = false if (data.attrs || data.props) { let keys = vm.$options.propKeys if (keys) { for (let i = 0; i < keys.length; i++) { let key = keys[i] - vm[key] = getPropValue(data, key, vm) + let oldVal = vm[key] + let newVal = getPropValue(data, key, vm) + if (oldVal !== newVal) { + vm[key] = newVal + changed = true + } } } } + return changed } function updateEvents (vm, data, oldData) { diff --git a/src/runtime/util/options.js b/src/runtime/util/options.js index eeedbb3e..6bbb3b2f 100644 --- a/src/runtime/util/options.js +++ b/src/runtime/util/options.js @@ -266,7 +266,6 @@ function guardProps (options) { : { type: val } } } - console.log(res) options.props = res }