Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better integration with Nuxt Server Components #2837

Open
gxres042 opened this issue Nov 7, 2024 · 0 comments
Open

Better integration with Nuxt Server Components #2837

gxres042 opened this issue Nov 7, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@gxres042
Copy link

gxres042 commented 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

Additional context

@gxres042 gxres042 added the enhancement New feature or request label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant