From fbf865d9d4744a0233db1ed6e5543b8f3ef51e8d Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 28 Jul 2020 11:12:43 -0400 Subject: [PATCH] fix(compiler-core): always compile Teleport and Suspense as blocks --- packages/compiler-core/src/transforms/transformElement.ts | 5 ++++- packages/runtime-core/src/vnode.ts | 6 +----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/compiler-core/src/transforms/transformElement.ts b/packages/compiler-core/src/transforms/transformElement.ts index 7b34a79827b..3bb9a83fd20 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 07dafcebac1..353ed863b05 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) }