Description
openedon Nov 7, 2024
Is your feature request related to a problem? Please describe
Since Nuxt 3.9, we can add a nuxt-client
attribute to a client component within a server component, such as <NuxtLink />
.
However, I tried this in Prose A component (for refresh-free navigation within the site), but click on this site link will refresh the whole page.
This is based on the fact that my MDC (essentially Nuxt Content's ContentRenderer) is already being used as a Server Component, and the code references Daniel Roe's usage:
import { ContentRendererMarkdown } from '#components'
export default defineComponent({
props: {
path: String,
},
async setup(props) {
if (import.meta.dev) {
const { data } = await useAsyncData(() =>
queryContent(props.path!).findOne()
)
return () => h(ContentRendererMarkdown, { value: data.value! })
}
const value = await queryContent(props.path!).findOne()
return () => h(ContentRendererMarkdown, { value })
},
})
Describe the solution you'd like
I would like Prose A to act as a server-side component and let me embed a <NuxtLink />
component with a nuxt-client
attribute to enable refresh-free navigation within the site.
Describe alternatives you've considered
Instead of using Nuxt Content, consider other combinations such as markdown-it + Headless CMS.
But there are not many of the latter that I'm happy with. I've spent weeks searching for, and have not found, a suitable