fix(slots): compiled slot fallback should be functions (#1030)
This avoids it being collected as dynamic children when it's not used. fix #1021
This commit is contained in:
@@ -15,8 +15,8 @@ export function renderSlot(
|
||||
name: string,
|
||||
props: Data = {},
|
||||
// this is not a user-facing function, so the fallback is always generated by
|
||||
// the compiler and guaranteed to be an array
|
||||
fallback?: VNodeArrayChildren
|
||||
// the compiler and guaranteed to be a function returning an array
|
||||
fallback?: () => VNodeArrayChildren
|
||||
): VNode {
|
||||
let slot = slots[name]
|
||||
|
||||
@@ -34,7 +34,7 @@ export function renderSlot(
|
||||
createBlock(
|
||||
Fragment,
|
||||
{ key: props.key },
|
||||
slot ? slot(props) : fallback || [],
|
||||
slot ? slot(props) : fallback ? fallback() : [],
|
||||
slots._ ? PatchFlags.STABLE_FRAGMENT : PatchFlags.BAIL
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user