Skip to content

Commit 275354c

Browse files
authored
fix(compiler-ssr): don't render v-if comments in TransitionGroup + static tag (#11515)
close #11514
1 parent 79602f9 commit 275354c

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

packages/compiler-ssr/__tests__/ssrTransitionGroup.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,28 @@ describe('transition-group', () => {
3838
`)
3939
})
4040

41+
// #11514
42+
test('with static tag + comment', () => {
43+
expect(
44+
compile(
45+
`<transition-group tag="ul"><div v-for="i in list"/><div v-if="false"></div></transition-group>`,
46+
).code,
47+
).toMatchInlineSnapshot(`
48+
"const { ssrRenderAttrs: _ssrRenderAttrs, ssrRenderList: _ssrRenderList } = require("vue/server-renderer")
49+
50+
return function ssrRender(_ctx, _push, _parent, _attrs) {
51+
_push(\`<ul\${_ssrRenderAttrs(_attrs)}>\`)
52+
_ssrRenderList(_ctx.list, (i) => {
53+
_push(\`<div></div>\`)
54+
})
55+
if (false) {
56+
_push(\`<div></div>\`)
57+
}
58+
_push(\`</ul>\`)
59+
}"
60+
`)
61+
})
62+
4163
test('with dynamic tag', () => {
4264
expect(
4365
compile(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function ssrProcessTransitionGroup(
108108
context.pushStringPart(` ${scopeId}`)
109109
}
110110
context.pushStringPart(`>`)
111-
processChildren(node, context, false, true)
111+
processChildren(node, context, false, true, true)
112112
context.pushStringPart(`</${tag.value!.content}>`)
113113
}
114114
} else {

0 commit comments

Comments
 (0)