From: Evan You Date: Wed, 18 May 2022 02:03:00 +0000 (+0800) Subject: fix(ssr): fix hydration error when transition contains comment children X-Git-Tag: v3.2.34~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3705b3b46aa8f3e929014f564f8afa4a663e6375;p=thirdparty%2Fvuejs%2Fcore.git fix(ssr): fix hydration error when transition contains comment children fix #5351 --- diff --git a/packages/compiler-ssr/src/transforms/ssrTransformComponent.ts b/packages/compiler-ssr/src/transforms/ssrTransformComponent.ts index 4c3a961cd6..df190c768a 100644 --- a/packages/compiler-ssr/src/transforms/ssrTransformComponent.ts +++ b/packages/compiler-ssr/src/transforms/ssrTransformComponent.ts @@ -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 {