fix(runtime-core): fix cases of reused children arrays in render functions (#3670)
fix #3666
This commit is contained in:
@@ -603,11 +603,16 @@ export function normalizeVNode(child: VNodeChild): VNode {
|
||||
return createVNode(Comment)
|
||||
} else if (isArray(child)) {
|
||||
// fragment
|
||||
return createVNode(Fragment, null, child)
|
||||
return createVNode(
|
||||
Fragment,
|
||||
null,
|
||||
// #3666, avoid reference pollution when reusing vnode
|
||||
child.slice()
|
||||
)
|
||||
} else if (typeof child === 'object') {
|
||||
// already vnode, this should be the most common since compiled templates
|
||||
// always produce all-vnode children arrays
|
||||
return child.el === null ? child : cloneVNode(child)
|
||||
return cloneIfMounted(child)
|
||||
} else {
|
||||
// strings and numbers
|
||||
return createVNode(Text, null, String(child))
|
||||
|
||||
Reference in New Issue
Block a user