@@ -26,7 +26,14 @@ import {
2626 mountComponent ,
2727 unmountComponent ,
2828} 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'
3037import { EMPTY_OBJ , extend , isFunction } from '@vue/shared'
3138import { type RawProps , rawPropsProxyHandlers } from './componentProps'
3239import type { RawSlots , VaporSlot } from './componentSlots'
@@ -230,7 +237,23 @@ function renderVDOMSlot(
230237 isFunction ( name ) ? name ( ) : name ,
231238 props ,
232239 )
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 ) {
234257 if ( fallbackNodes ) {
235258 remove ( fallbackNodes , parentNode )
236259 fallbackNodes = undefined
@@ -251,8 +274,8 @@ function renderVDOMSlot(
251274 }
252275 insert ( ( fallbackNodes = fallback ( props ) ) , parentNode , anchor )
253276 }
254- oldVNode = null
255277 }
278+ oldVNode = null
256279 } )
257280 isMounted = true
258281 } else {
0 commit comments