(props, ctx)
| 8 | props, |
| 9 | emits: ['hydrated'], |
| 10 | setup (props, ctx) { |
| 11 | if (import.meta.server) { |
| 12 | const nuxtApp = useNuxtApp() |
| 13 | nuxtApp.hook('app:rendered', ({ ssrContext }) => { |
| 14 | // track lazy hydrated components so prefetch/preload tags are not rendered for them |
| 15 | // but keep them in modules so CSS links are still rendered |
| 16 | ssrContext!['~lazyHydratedModules'] ||= new Set() |
| 17 | ssrContext!['~lazyHydratedModules'].add(id) |
| 18 | }) |
| 19 | } |
| 20 | // wrap the async component in a second component to avoid loading the chunk too soon |
| 21 | const child = defineAsyncComponent({ loader }) |
| 22 | const comp = defineAsyncComponent({ |
| 23 | hydrate: defineStrategy(props as ExtractPropTypes<P>), |
| 24 | loader: () => Promise.resolve(child), |
| 25 | }) |
| 26 | const onVnodeMounted = () => { ctx.emit('hydrated') } |
| 27 | return () => h(comp, mergeProps(ctx.attrs, { onVnodeMounted }), ctx.slots) |
| 28 | }, |
| 29 | }) |
| 30 | } |
| 31 |
nothing calls this directly
no test coverage detected
searching dependent graphs…