Skip to content

Commit 2f8e6fc

Browse files
committed
fix(runtime): normalizeNode slots for createComponentWithFallback
1 parent 0c5b966 commit 2f8e6fc

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

packages/runtime/src/component.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,26 @@ export const createComponent = (
1919
export const createComponentWithFallback = (
2020
type: VaporComponent | typeof Fragment,
2121
...args: Tail<Parameters<typeof _createComponentWithFallback>>
22-
) => createProxyComponent(_createComponentWithFallback, type, ...args)
22+
) => {
23+
const slots = args[1]
24+
if (
25+
typeof type === 'string' &&
26+
slots &&
27+
slots.default &&
28+
typeof slots.default === 'function'
29+
) {
30+
const defaultSlot = slots.default
31+
slots.default = () => {
32+
return createProxyComponent(
33+
_createComponentWithFallback,
34+
defaultSlot,
35+
null,
36+
null,
37+
)
38+
}
39+
}
40+
return createProxyComponent(_createComponentWithFallback, type, ...args)
41+
}
2342

2443
const createProxyComponent = (
2544
createComponent:

0 commit comments

Comments
 (0)