Skip to content

Commit

Permalink
fix(ssrRenderSlot): check fallbackRenderFn if slotContent is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
nieyuyao committed Aug 6, 2024
1 parent 9daab07 commit 7eb3b6a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/server-renderer/src/helpers/ssrRenderSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,19 @@ export function ssrRenderSlotInner(
parentComponent,
slotScopeId ? ' ' + slotScopeId : '',
)
if (isArray(ret) && ensureValidVNode(ret)) {
// normal slot
renderVNodeChildren(push, ret, parentComponent, slotScopeId)
if (isArray(ret)) {
const validSlotContent = ensureValidVNode(ret)
if (validSlotContent) {
// normal slot
renderVNodeChildren(
push,
validSlotContent,
parentComponent,
slotScopeId,
)
} else if (fallbackRenderFn) {
fallbackRenderFn()
}
} else {
// ssr slot.
// check if the slot renders all comments, in which case use the fallback
Expand Down

0 comments on commit 7eb3b6a

Please sign in to comment.