From: Evan You Date: Tue, 28 Jul 2020 15:12:43 +0000 (-0400) Subject: fix(compiler-core): always compile Teleport and Suspense as blocks X-Git-Tag: v3.0.0-rc.5~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbf865d9d4744a0233db1ed6e5543b8f3ef51e8d;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-core): always compile Teleport and Suspense as blocks --- diff --git a/packages/compiler-core/src/transforms/transformElement.ts b/packages/compiler-core/src/transforms/transformElement.ts index 7b34a79827..3bb9a83fd2 100644 --- a/packages/compiler-core/src/transforms/transformElement.ts +++ b/packages/compiler-core/src/transforms/transformElement.ts @@ -35,7 +35,8 @@ import { MERGE_PROPS, TO_HANDLERS, TELEPORT, - KEEP_ALIVE + KEEP_ALIVE, + SUSPENSE } from '../runtimeHelpers' import { getInnerRange, @@ -89,6 +90,8 @@ export const transformElement: NodeTransform = (node, context) => { let shouldUseBlock = // dynamic component may resolve to plain elements isDynamicComponent || + vnodeTag === TELEPORT || + vnodeTag === SUSPENSE || (!isComponent && // and must be forced into blocks so that block // updates inside get proper isSVG flag at runtime. (#639, #643) diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index 07dafcebac..353ed863b0 100644 --- a/packages/runtime-core/src/vnode.ts +++ b/packages/runtime-core/src/vnode.ts @@ -411,11 +411,7 @@ function _createVNode( // the EVENTS flag is only for hydration and if it is the only flag, the // vnode should not be considered dynamic due to handler caching. patchFlag !== PatchFlags.HYDRATE_EVENTS && - (patchFlag > 0 || - shapeFlag & ShapeFlags.SUSPENSE || - shapeFlag & ShapeFlags.TELEPORT || - shapeFlag & ShapeFlags.STATEFUL_COMPONENT || - shapeFlag & ShapeFlags.FUNCTIONAL_COMPONENT) + (patchFlag > 0 || shapeFlag & ShapeFlags.COMPONENT) ) { currentBlock.push(vnode) }