From: Evan You Date: Mon, 11 May 2020 17:53:15 +0000 (-0400) Subject: fix(runtime-core): should not take unmount children fast path for v-for fragments X-Git-Tag: v3.0.0-beta.11~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b8883a84689dd04dbbcd677bf177ffeda43489d;p=thirdparty%2Fvuejs%2Fcore.git fix(runtime-core): should not take unmount children fast path for v-for fragments fix #1153 --- diff --git a/packages/runtime-core/src/renderer.ts b/packages/runtime-core/src/renderer.ts index 40aa47f19d..956f332691 100644 --- a/packages/runtime-core/src/renderer.ts +++ b/packages/runtime-core/src/renderer.ts @@ -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 @@ -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) {