-
Notifications
You must be signed in to change notification settings - Fork 7
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
Update to version 1.7.18 of healessui/vue #41
Comments
This module uses ^1.0.0 syntax for the headless UI version, so that you can install whatever version you like and can update headless UI without updating this dependency. Just refresh your lock file, or install the latest version manually. Remember that the fix requires you to add code to your app.vue file to provide the id generation function. This module can't do this for you due to limitations with the useId hook by nuxt. |
I just made a reproduction because I still had mismatches after using the recommended fix. Turns out it only happens if I am using the Components through your module. Importing the components explicitly fixes the mismatches. You can easily check by un-commenting the imports. |
i can confirm this issue! |
I can reproduce the issue, but did not yet find the reason for it. My guess right now is a symbol mismatch due to different imports, but I am not sure yet. |
I invested a few hours today, but was unable to find out why this is not working. |
@P4sca1 yeah i also could the in the DOM that the ids with the -i suffixe where generated |
adding this to app.vue fixed it for me, at least until we get a proper fix
|
Looking at the network logs, it looks like my To fix it, exclude the library from being optimized by Vite:
It is my understanding that dependencies are not pre-bundled during production at all (i.e. this is a dev only problem), so this should have no performance or size impact on the final build. |
Interesting find. Because there are 2 different bundles, the symbols that get injected likely don't match, which is causing the issue. Thank you for posting a workaround. I will check if it makes sense to include it by default. |
This issue is likely related vitejs/vite#3910 and mentions the same workaround. |
// Use SSR-safe IDs for Headless UI
provideHeadlessUseId(() => useId()) |
@geofany Ensure you are using Nuxt 2.10 or newer. If you have auto imports disabled, import the composables manually. |
can this be useful now: https://blog.vuejs.org/posts/vue-3-5#useid |
Yes, but it needs to be integrated into |
If you upgrade vue to 3.5.0 or newer and |
HeadlessUI deployed a fix for Nuxt hydration error for generated ids.
Reference: tailwindlabs/headlessui#2913
The text was updated successfully, but these errors were encountered: