|
@@ -1,4 +1,4 @@
|
|
|
-import type { ComponentInternalInstance, Slots } from 'vue'
|
|
|
|
|
|
|
+import { type ComponentInternalInstance, type Slots, ssrUtils } from 'vue'
|
|
|
import {
|
|
import {
|
|
|
type Props,
|
|
type Props,
|
|
|
type PushFn,
|
|
type PushFn,
|
|
@@ -7,6 +7,8 @@ import {
|
|
|
} from '../render'
|
|
} from '../render'
|
|
|
import { isArray } from '@vue/shared'
|
|
import { isArray } from '@vue/shared'
|
|
|
|
|
|
|
|
|
|
+const { ensureValidVNode } = ssrUtils
|
|
|
|
|
+
|
|
|
export type SSRSlots = Record<string, SSRSlot>
|
|
export type SSRSlots = Record<string, SSRSlot>
|
|
|
export type SSRSlot = (
|
|
export type SSRSlot = (
|
|
|
props: Props,
|
|
props: Props,
|
|
@@ -61,8 +63,18 @@ export function ssrRenderSlotInner(
|
|
|
slotScopeId ? ' ' + slotScopeId : '',
|
|
slotScopeId ? ' ' + slotScopeId : '',
|
|
|
)
|
|
)
|
|
|
if (isArray(ret)) {
|
|
if (isArray(ret)) {
|
|
|
- // normal slot
|
|
|
|
|
- renderVNodeChildren(push, ret, parentComponent, slotScopeId)
|
|
|
|
|
|
|
+ const validSlotContent = ensureValidVNode(ret)
|
|
|
|
|
+ if (validSlotContent) {
|
|
|
|
|
+ // normal slot
|
|
|
|
|
+ renderVNodeChildren(
|
|
|
|
|
+ push,
|
|
|
|
|
+ validSlotContent,
|
|
|
|
|
+ parentComponent,
|
|
|
|
|
+ slotScopeId,
|
|
|
|
|
+ )
|
|
|
|
|
+ } else if (fallbackRenderFn) {
|
|
|
|
|
+ fallbackRenderFn()
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
// ssr slot.
|
|
// ssr slot.
|
|
|
// check if the slot renders all comments, in which case use the fallback
|
|
// check if the slot renders all comments, in which case use the fallback
|