Skip to content

Commit

Permalink
fix(compiler-core): always compile Teleport and Suspense as blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 28, 2020
1 parent b3b65b4 commit fbf865d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 4 additions & 1 deletion packages/compiler-core/src/transforms/transformElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import {
MERGE_PROPS,
TO_HANDLERS,
TELEPORT,
KEEP_ALIVE
KEEP_ALIVE,
SUSPENSE
} from '../runtimeHelpers'
import {
getInnerRange,
Expand Down Expand Up @@ -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 &&
// <svg> and <foreignObject> must be forced into blocks so that block
// updates inside get proper isSVG flag at runtime. (#639, #643)
Expand Down
6 changes: 1 addition & 5 deletions packages/runtime-core/src/vnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit fbf865d

Please sign in to comment.