Skip to content

Commit 20b4615

Browse files
fix(patch.js): Added a check for duplicated keys before addVnodes in patchVnodes function.
Added a check for duplicated keys in the case that addVnodes is called instead of createChildren or updateChildren. This cover the case when a empty div is change into a div with a list of childrens with a duplicated key inside after initial rendering (see issue vuejs#8832). fix vuejs#8832
1 parent 79cabad commit 20b4615

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/core/vdom/patch.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,9 @@ export function createPatchFunction (backend) {
543543
if (isDef(oldCh) && isDef(ch)) {
544544
if (oldCh !== ch) updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly)
545545
} else if (isDef(ch)) {
546+
if (process.env.NODE_ENV !== 'production') {
547+
checkDuplicateKeys(ch)
548+
}
546549
if (isDef(oldVnode.text)) nodeOps.setTextContent(elm, '')
547550
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue)
548551
} else if (isDef(oldCh)) {

0 commit comments

Comments
 (0)