Skip to content

Commit

Permalink
fix(runtime-core): should not take unmount children fast path for v-f…
Browse files Browse the repository at this point in the history
…or fragments

fix #1153
  • Loading branch information
yyx990803 committed May 11, 2020
1 parent 697de07 commit 5b8883a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages/runtime-core/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,16 @@ function baseCreateRenderer(
parentSuspense,
doRemove = false
) => {
const { props, ref, children, dynamicChildren, shapeFlag, dirs } = vnode
const {
type,
props,
ref,
children,
dynamicChildren,
shapeFlag,
patchFlag,
dirs
} = vnode
const shouldInvokeDirs = shapeFlag & ShapeFlags.ELEMENT && dirs
const shouldKeepAlive = shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE
let vnodeHook: VNodeHook | undefined | null
Expand Down Expand Up @@ -1755,7 +1764,12 @@ function baseCreateRenderer(
invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount')
}

if (dynamicChildren) {
if (
dynamicChildren &&
// #1153: fast path should not be taken for non-stable (v-for) fragments
(type !== Fragment ||
(patchFlag > 0 && patchFlag & PatchFlags.STABLE_FRAGMENT))
) {
// fast path for block nodes: only need to unmount dynamic children.
unmountChildren(dynamicChildren, parentComponent, parentSuspense)
} else if (shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
Expand Down

0 comments on commit 5b8883a

Please sign in to comment.