diff --git a/packages/nuxt/src/app/components/client-only.ts b/packages/nuxt/src/app/components/client-only.ts index 46149f6a79..b3c9aeb3a1 100644 --- a/packages/nuxt/src/app/components/client-only.ts +++ b/packages/nuxt/src/app/components/client-only.ts @@ -14,7 +14,7 @@ export default defineComponent({ inheritAttrs: false, props: ['fallback', 'placeholder', 'placeholderTag', 'fallbackTag'], - setup (_, { slots, attrs }) { + setup (props, { slots, attrs }) { const mounted = ref(false) onMounted(() => { mounted.value = true }) // Bail out of checking for pages/layouts as they might be included under `` 🤷‍♂️ @@ -24,10 +24,10 @@ export default defineComponent({ nuxtApp._isNuxtLayoutUsed = true } provide(clientOnlySymbol, true) - return (props: any) => { + return () => { if (mounted.value) { return slots.default?.() } const slot = slots.fallback || slots.placeholder - if (slot) { return slot() } + if (slot) { return h(slot) } const fallbackStr = props.fallback || props.placeholder || '' const fallbackTag = props.fallbackTag || props.placeholderTag || 'span' return createElementBlock(fallbackTag, attrs, fallbackStr)