]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler-core): always compile Teleport and Suspense as blocks
authorEvan You <yyx990803@gmail.com>
Tue, 28 Jul 2020 15:12:43 +0000 (11:12 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 28 Jul 2020 15:12:43 +0000 (11:12 -0400)
packages/compiler-core/src/transforms/transformElement.ts
packages/runtime-core/src/vnode.ts

index 7b34a79827b04e44298a80c21f459936ea357430..3bb9a83fd20f357f75be2018990f9abc34e3c9a6 100644 (file)
@@ -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 &&
         // <svg> and <foreignObject> must be forced into blocks so that block
         // updates inside get proper isSVG flag at runtime. (#639, #643)
index 07dafcebac1a52fc2cc114715098b2451f625454..353ed863b05dfb0fa35c6eaf61131827fa2fa433 100644 (file)
@@ -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)
   }