-
Notifications
You must be signed in to change notification settings - Fork 369
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
[Bug]: shadcn-nuxt
produces hydration warnings for some components
#257
Comments
This issue is not on your end. It appeared after Vue 3.4 as it now checks for hydration mismatches in attributes. This also happens in Nuxt UI for example. There's a PR that introduces new |
I'm also seeing this. Temporary solution for me was to pin vue to 3.3.13...
|
It doesn't fix the problem, it just hides the warnings. The problem remains the same. A |
Seems there was a useId() added for nuxt 3.10 https://nuxt.com/blog/v3-10#ssr-safe-accessible-unique-id-creation |
This seems to happen with the auto imported component. I've reported this to the Nuxt repo aswell with reproduction link: nuxt/nuxt#25696 |
I had the same problem with the form example. Fixed this case locally inside <script lang="ts" setup>
import { provide } from 'vue'
import { useId } from 'radix-vue' <-- remove this one
import { cn } from '@/lib/utils'
const props = defineProps<{
class?: HTMLAttributes['class']
}>()
const id = useId()
provide(FORM_ITEM_INJECTION_KEY, id)
</script> |
This might be a solution for Form components, but I still have issues with plain components (auto imported). |
I'd like to point out that the solution @peterhijma works for Form 🙏 . |
@MercurialUroboros Try this #637 (comment) in your app.vue |
@MercurialUroboros @MuhammadM1998 Did you have any issue with components like the Progress component? |
Thank you!! |
Over the past six months, I’ve extensively used Shadcn and tested nearly every component. While the useId() fix for Nuxt has resolved most hydration issues, I’m still encountering a Vue hydration error with the Menubar component. I’ve tried various approaches to address this, but the issue persists. I’m not aware of any current workarounds. |
using shadcn components with |
im also using shadcn-vue with Nuxt and implemented the ssr hydration fix with useId() but for me it's still throwing hydration errors using the Navigation Menu with Nuxt links |
Also happens with the accordion component
|
having this same issue, even if i use a custom
i guess this can be fixed now with vue 3.5? it features a new useId. |
@alan-bevz
|
@ivan-angjelkoski |
Testing in Nuxt |
|
it is as of today unovue/reka-ui@20a755e 🎉 |
Yes, I made a mistake and misunderstood the fix. |
I'm using the latest |
Having the same issue with dropdown, any solutions ? |
For those who have encountered hydration errors in the DropdownMenu component, try adding the
|
Hey, for anyone that is having this problem - just as a note. I was having issues with:
When what worked was moving the div into the layout:
|
Environment
Link to minimal reproduction
https://stackblitz.com/edit/nuxt-starter-rgoa7e?file=pages%2Findex.vue
Steps to reproduce
Install and set up
shadcn-nuxt
with<Accordion>
and<Button>
components.Describe the bug
Since 0.8.6 some components in my project such as
<Button>
,<AccordionTrigger>
and<AccordionContent>
produce these SSR-related warnings.I tried initializing shadcn-vue again, deleting node_modules and package-lock.json and reinstalling the project, but nothing helped. It seems to come from the version of
radix-vue
used byshadcn-nuxt
.Expected behavior
No response
Conext & Screenshots (if applicable)
No response
The text was updated successfully, but these errors were encountered: