Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(patch): Do not consider nodes with different scope ids the same (fix #10416) #12938

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/core/vdom/patch.js
Expand Up @@ -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)
Expand All @@ -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 = {}
Expand Down