})
if (_ctx.ok) {
_push(\`<div>ok</div>\`)
- } else {
- _push(\`<!---->\`)
}
_push(\`<!--]-->\`)
}"
context: SSRTransformContext,
asFragment = false,
disableNestedFragments = false,
+ disableCommentAsIfAlternate = false,
) {
if (asFragment) {
context.pushStringPart(`<!--[-->`)
)
break
case NodeTypes.IF:
- ssrProcessIf(child, context, disableNestedFragments)
+ ssrProcessIf(
+ child,
+ context,
+ disableNestedFragments,
+ disableCommentAsIfAlternate,
+ )
break
case NodeTypes.FOR:
ssrProcessFor(child, context, disableNestedFragments)
* by disabling nested fragment wrappers from being generated.
*/
true,
+ /**
+ * TransitionGroup filters out comment children at runtime and thus
+ * doesn't expect comments to be present during hydration. We need to
+ * account for that by disabling the empty comment that is otherwise
+ * rendered for a falsy v-if that has no v-else specified. (#6715)
+ */
+ true,
)
context.pushStringPart(`</`)
context.pushStringPart(tag.exp!)
}
} else {
// fragment
- processChildren(node, context, true, true)
+ processChildren(node, context, true, true, true)
}
}
node: IfNode,
context: SSRTransformContext,
disableNestedFragments = false,
+ disableCommentAsIfAlternate = false,
) {
const [rootBranch] = node.branches
const ifStatement = createIfStatement(
}
}
- if (!currentIf.alternate) {
+ if (!currentIf.alternate && !disableCommentAsIfAlternate) {
currentIf.alternate = createBlockStatement([
createCallExpression(`_push`, ['`<!---->`']),
])