]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
feat(transition): warn non-animatable component root node
authorEvan You <yyx990803@gmail.com>
Mon, 25 Nov 2019 15:04:00 +0000 (10:04 -0500)
committerEvan You <yyx990803@gmail.com>
Mon, 25 Nov 2019 16:41:28 +0000 (11:41 -0500)
packages/runtime-core/src/componentRenderUtils.ts

index d42982d580b9ca14978c5b4c92acf6c8cfd7b7e1..7663677c67109b9917c400f86e832234646ea349 100644 (file)
@@ -88,7 +88,16 @@ export function renderComponentRoot(
 
     // inherit transition data
     if (vnode.transition != null) {
-      // TODO warn if component has transition data but root is a fragment
+      if (
+        __DEV__ &&
+        !(result.shapeFlag & ShapeFlags.COMPONENT) &&
+        !(result.shapeFlag & ShapeFlags.ELEMENT)
+      ) {
+        warn(
+          `Component inside <Transition> renders non-element root node ` +
+            `that cannot be animated.`
+        )
+      }
       result.transition = vnode.transition
     }
   } catch (err) {