diff --git a/src/core/vdom/patch.js b/src/core/vdom/patch.js index bff48f44bea..6d7c54aab3a 100644 --- a/src/core/vdom/patch.js +++ b/src/core/vdom/patch.js @@ -40,7 +40,8 @@ function sameVnode (a, b) { a.tag === b.tag && a.isComment === b.isComment && isDef(a.data) === isDef(b.data) && - sameInputType(a, b) + sameInputType(a, b) && + findScopeId(a) === findScopeId(b) ) || ( isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error) @@ -67,6 +68,20 @@ function createKeyToOldIdx (children, beginIdx, endIdx) { return map } +function findScopeId (node) { + if (isDef(node.fnScopeId)) { + return node.fnScopeId + } + + let ancestor = node + while (ancestor) { + if (isDef(ancestor.context) && isDef(ancestor.context.$options._scopeId)) { + return ancestor.context.$options._scopeId + } + ancestor = ancestor.parent + } +} + export function createPatchFunction (backend) { let i, j const cbs = {}