@@ -26,7 +26,14 @@ import {
26
26
mountComponent ,
27
27
unmountComponent ,
28
28
} from './component'
29
- import { type Block , VaporFragment , insert , remove } from './block'
29
+ import {
30
+ type Block ,
31
+ VaporFragment ,
32
+ insert ,
33
+ isFragment ,
34
+ isValidBlock ,
35
+ remove ,
36
+ } from './block'
30
37
import { EMPTY_OBJ , extend , isFunction } from '@vue/shared'
31
38
import { type RawProps , rawPropsProxyHandlers } from './componentProps'
32
39
import type { RawSlots , VaporSlot } from './componentSlots'
@@ -230,7 +237,23 @@ function renderVDOMSlot(
230
237
isFunction ( name ) ? name ( ) : name ,
231
238
props ,
232
239
)
233
- if ( ( vnode . children as any [ ] ) . length ) {
240
+ let isValidSlotContent
241
+ let children = vnode . children as any [ ]
242
+
243
+ // handle forwarded vapor slot
244
+ let vaporSlot
245
+ if ( children . length === 1 && ( vaporSlot = children [ 0 ] . vs ) ) {
246
+ const block = vaporSlot . slot ( props )
247
+ isValidSlotContent =
248
+ isValidBlock ( block ) ||
249
+ // if block is a vapor fragment with insert, it indicates a forwarded VDOM slot
250
+ ( isFragment ( block ) && block . insert )
251
+ }
252
+ // vnode children
253
+ else {
254
+ isValidSlotContent = children . length > 0
255
+ }
256
+ if ( isValidSlotContent ) {
234
257
if ( fallbackNodes ) {
235
258
remove ( fallbackNodes , parentNode )
236
259
fallbackNodes = undefined
@@ -251,8 +274,8 @@ function renderVDOMSlot(
251
274
}
252
275
insert ( ( fallbackNodes = fallback ( props ) ) , parentNode , anchor )
253
276
}
254
- oldVNode = null
255
277
}
278
+ oldVNode = null
256
279
} )
257
280
isMounted = true
258
281
} else {
0 commit comments