]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(ssr): fix hydration error when transition contains comment children
authorEvan You <yyx990803@gmail.com>
Wed, 18 May 2022 02:03:00 +0000 (10:03 +0800)
committerEvan You <yyx990803@gmail.com>
Wed, 18 May 2022 02:03:00 +0000 (10:03 +0800)
fix #5351

packages/compiler-ssr/src/transforms/ssrTransformComponent.ts

index 4c3a961cd6598a11da8d6c677dc6bd844c19f2e0..df190c768a8b938b5542b10e86d8890c88b68c85 100644 (file)
@@ -35,7 +35,8 @@ import {
   CREATE_VNODE,
   CallExpression,
   JSChildNode,
-  RESOLVE_DYNAMIC_COMPONENT
+  RESOLVE_DYNAMIC_COMPONENT,
+  TRANSITION
 } from '@vue/compiler-dom'
 import { SSR_RENDER_COMPONENT, SSR_RENDER_VNODE } from '../runtimeHelpers'
 import {
@@ -213,6 +214,10 @@ export function ssrProcessComponent(
       if ((parent as WIPSlotEntry).type === WIP_SLOT) {
         context.pushStringPart(``)
       }
+      // #5351: filter out comment children inside transition
+      if (component === TRANSITION) {
+        node.children = node.children.filter(c => c.type !== NodeTypes.COMMENT)
+      }
       processChildren(node, context)
     }
   } else {