Skip to content

Commit 5b8883a

Browse files
committed
fix(runtime-core): should not take unmount children fast path for v-for fragments
fix #1153
1 parent 697de07 commit 5b8883a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

packages/runtime-core/src/renderer.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,16 @@ function baseCreateRenderer(
17251725
parentSuspense,
17261726
doRemove = false
17271727
) => {
1728-
const { props, ref, children, dynamicChildren, shapeFlag, dirs } = vnode
1728+
const {
1729+
type,
1730+
props,
1731+
ref,
1732+
children,
1733+
dynamicChildren,
1734+
shapeFlag,
1735+
patchFlag,
1736+
dirs
1737+
} = vnode
17291738
const shouldInvokeDirs = shapeFlag & ShapeFlags.ELEMENT && dirs
17301739
const shouldKeepAlive = shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE
17311740
let vnodeHook: VNodeHook | undefined | null
@@ -1755,7 +1764,12 @@ function baseCreateRenderer(
17551764
invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount')
17561765
}
17571766

1758-
if (dynamicChildren) {
1767+
if (
1768+
dynamicChildren &&
1769+
// #1153: fast path should not be taken for non-stable (v-for) fragments
1770+
(type !== Fragment ||
1771+
(patchFlag > 0 && patchFlag & PatchFlags.STABLE_FRAGMENT))
1772+
) {
17591773
// fast path for block nodes: only need to unmount dynamic children.
17601774
unmountChildren(dynamicChildren, parentComponent, parentSuspense)
17611775
} else if (shapeFlag & ShapeFlags.ARRAY_CHILDREN) {

0 commit comments

Comments
 (0)