Skip to content

Commit fbf865d

Browse files
committed
fix(compiler-core): always compile Teleport and Suspense as blocks
1 parent b3b65b4 commit fbf865d

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/compiler-core/src/transforms/transformElement.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ import {
3535
MERGE_PROPS,
3636
TO_HANDLERS,
3737
TELEPORT,
38-
KEEP_ALIVE
38+
KEEP_ALIVE,
39+
SUSPENSE
3940
} from '../runtimeHelpers'
4041
import {
4142
getInnerRange,
@@ -89,6 +90,8 @@ export const transformElement: NodeTransform = (node, context) => {
8990
let shouldUseBlock =
9091
// dynamic component may resolve to plain elements
9192
isDynamicComponent ||
93+
vnodeTag === TELEPORT ||
94+
vnodeTag === SUSPENSE ||
9295
(!isComponent &&
9396
// <svg> and <foreignObject> must be forced into blocks so that block
9497
// updates inside get proper isSVG flag at runtime. (#639, #643)

packages/runtime-core/src/vnode.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -411,11 +411,7 @@ function _createVNode(
411411
// the EVENTS flag is only for hydration and if it is the only flag, the
412412
// vnode should not be considered dynamic due to handler caching.
413413
patchFlag !== PatchFlags.HYDRATE_EVENTS &&
414-
(patchFlag > 0 ||
415-
shapeFlag & ShapeFlags.SUSPENSE ||
416-
shapeFlag & ShapeFlags.TELEPORT ||
417-
shapeFlag & ShapeFlags.STATEFUL_COMPONENT ||
418-
shapeFlag & ShapeFlags.FUNCTIONAL_COMPONENT)
414+
(patchFlag > 0 || shapeFlag & ShapeFlags.COMPONENT)
419415
) {
420416
currentBlock.push(vnode)
421417
}

0 commit comments

Comments
 (0)