@@ -104,45 +104,47 @@ export function createSlot(
104
104
? new Proxy ( rawProps , rawPropsProxyHandlers )
105
105
: EMPTY_OBJ
106
106
107
+ let fragment : DynamicFragment
108
+
107
109
if ( isRef ( rawSlots . _ ) ) {
108
- return instance . appContext . vapor ! . vdomSlot (
110
+ fragment = instance . appContext . vapor ! . vdomSlot (
109
111
rawSlots . _ ,
110
112
name ,
111
113
slotProps ,
112
114
instance ,
113
115
fallback ,
114
116
)
115
- }
117
+ } else {
118
+ fragment = __DEV__ ? new DynamicFragment ( 'slot' ) : new DynamicFragment ( )
119
+ const isDynamicName = isFunction ( name )
120
+ const renderSlot = ( ) => {
121
+ const slot = getSlot ( rawSlots , isFunction ( name ) ? name ( ) : name )
122
+ if ( slot ) {
123
+ // create and cache bound version of the slot to make it stable
124
+ // so that we avoid unnecessary updates if it resolves to the same slot
125
+ fragment . update (
126
+ slot . _bound ||
127
+ ( slot . _bound = ( ) => {
128
+ const slotContent = slot ( slotProps )
129
+ if ( slotContent instanceof DynamicFragment ) {
130
+ slotContent . fallback = fallback
131
+ }
132
+ return slotContent
133
+ } ) ,
134
+ )
135
+ } else {
136
+ fragment . update ( fallback )
137
+ }
138
+ }
116
139
117
- const isDynamicName = isFunction ( name )
118
- const fragment = __DEV__ ? new DynamicFragment ( 'slot' ) : new DynamicFragment ( )
119
- const renderSlot = ( ) => {
120
- const slot = getSlot ( rawSlots , isFunction ( name ) ? name ( ) : name )
121
- if ( slot ) {
122
- // create and cache bound version of the slot to make it stable
123
- // so that we avoid unnecessary updates if it resolves to the same slot
124
- fragment . update (
125
- slot . _bound ||
126
- ( slot . _bound = ( ) => {
127
- const slotContent = slot ( slotProps )
128
- if ( slotContent instanceof DynamicFragment ) {
129
- slotContent . fallback = fallback
130
- }
131
- return slotContent
132
- } ) ,
133
- )
140
+ // dynamic slot name or has dynamicSlots
141
+ if ( isDynamicName || rawSlots . $ ) {
142
+ renderEffect ( renderSlot )
134
143
} else {
135
- fragment . update ( fallback )
144
+ renderSlot ( )
136
145
}
137
146
}
138
147
139
- // dynamic slot name or has dynamicSlots
140
- if ( isDynamicName || rawSlots . $ ) {
141
- renderEffect ( renderSlot )
142
- } else {
143
- renderSlot ( )
144
- }
145
-
146
148
if ( ! isHydrating && _insertionParent ) {
147
149
insert ( fragment , _insertionParent , _insertionAnchor )
148
150
}
0 commit comments