mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(nuxt): don't check for layout/page with <ClientOnly>
(#25714)
This commit is contained in:
parent
3c271413f8
commit
fd671a27ea
@ -1,5 +1,6 @@
|
||||
import { cloneVNode, createElementBlock, createStaticVNode, defineComponent, getCurrentInstance, h, onMounted, provide, ref } from 'vue'
|
||||
import type { ComponentInternalInstance, ComponentOptions, InjectionKey } from 'vue'
|
||||
import { useNuxtApp } from '../nuxt'
|
||||
import { getFragmentHTML } from './utils'
|
||||
|
||||
export const clientOnlySymbol: InjectionKey<boolean> = Symbol.for('nuxt:client-only')
|
||||
@ -12,6 +13,12 @@ export default defineComponent({
|
||||
setup (_, { slots, attrs }) {
|
||||
const mounted = ref(false)
|
||||
onMounted(() => { mounted.value = true })
|
||||
// Bail out of checking for pages/layouts as they might be included under `<ClientOnly>` 🤷♂️
|
||||
if (import.meta.dev) {
|
||||
const nuxtApp = useNuxtApp()
|
||||
nuxtApp._isNuxtPageUsed = true
|
||||
nuxtApp._isNuxtLayoutUsed = true
|
||||
}
|
||||
provide(clientOnlySymbol, true)
|
||||
return (props: any) => {
|
||||
if (mounted.value) { return slots.default?.() }
|
||||
|
Loading…
Reference in New Issue
Block a user