Skip to content

Commit 7eb3b6a

Browse files
committed
fix(ssrRenderSlot): check fallbackRenderFn if slotContent is invalid
1 parent 9daab07 commit 7eb3b6a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

packages/server-renderer/src/helpers/ssrRenderSlot.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,19 @@ export function ssrRenderSlotInner(
6262
parentComponent,
6363
slotScopeId ? ' ' + slotScopeId : '',
6464
)
65-
if (isArray(ret) && ensureValidVNode(ret)) {
66-
// normal slot
67-
renderVNodeChildren(push, ret, parentComponent, slotScopeId)
65+
if (isArray(ret)) {
66+
const validSlotContent = ensureValidVNode(ret)
67+
if (validSlotContent) {
68+
// normal slot
69+
renderVNodeChildren(
70+
push,
71+
validSlotContent,
72+
parentComponent,
73+
slotScopeId,
74+
)
75+
} else if (fallbackRenderFn) {
76+
fallbackRenderFn()
77+
}
6878
} else {
6979
// ssr slot.
7080
// check if the slot renders all comments, in which case use the fallback

0 commit comments

Comments
 (0)