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

fix(components): hydration attribute mismatch with vue 3.4 #1199

Merged
merged 17 commits into from
Feb 6, 2024
Merged

Conversation

benjamincanac
Copy link
Member

@benjamincanac benjamincanac commented Jan 4, 2024

πŸ”— Linked issue

Fixes #1171, fixes nuxt/ui-pro#181

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

We leverage the new useId composable from Nuxt v3.10.0 and provideUseId from Headless UI v1.7.18 (tailwindlabs/headlessui#2959) to fix hydration mismatches warned since Vue v3.4.

Warning

Since we leverage useId, you'll need to install Nuxt v3.10.0.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

vercel bot commented Jan 4, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
ui βœ… Ready (Inspect) Visit Preview Feb 6, 2024 11:40am

@MuhammadM1998
Copy link
Contributor

useId has been added in Nuxt 3.10 nuxt/nuxt#23368 which will internally swap to vue's implementation when it ships in vue 3.5 which won't affect the user. Do you think utilizing it directly will be easier?

Copy link
Member Author

This PR was just a test, I'll use useId from Nuxt 3.10 instead.

@benjamincanac benjamincanac changed the title fix(components): hydration attribute mismatch with vue 3.4 fix: hydration attribute mismatch with vue 3.4 Jan 31, 2024
@benjamincanac benjamincanac marked this pull request as ready for review January 31, 2024 17:18
@benjamincanac
Copy link
Member Author

@MuhammadM1998 I've updated the PR, do you want to take a look?

@benjamincanac
Copy link
Member Author

There are still some hydration issues on the Disclosure component but we can't do anything about it yet: tailwindlabs/headlessui#2913

@MuhammadM1998
Copy link
Contributor

Yeah you mentioned that in another PR I think and I saw it. Seems good to me and I can help testing it locally (or testing the edge release after this gets merged) if you want

Copy link
Member Author

Would be very helpful yes! 😊 I've seen some hydration issues remaining on checkbox still.

@MuhammadM1998
Copy link
Contributor

Sure I'll take a look at it asap

@benjamincanac benjamincanac marked this pull request as draft February 1, 2024 11:50
@benjamincanac
Copy link
Member Author

I'm also having some issues with the Tabs and Combobox.

@MuhammadM1998
Copy link
Contributor

I'll check them too when I have some time hopefully

@MuhammadM1998
Copy link
Contributor

Sorry I was really busy this week. Its on my todo list for the weekend and I'll try my best to test it. I see you bumped headless vue which should solve more issues with the IDs right?

@benjamincanac
Copy link
Member Author

@MuhammadM1998 Should be good now yes 😊

@benjamincanac benjamincanac changed the title fix: hydration attribute mismatch with vue 3.4 fix(components): hydration attribute mismatch with vue 3.4 Feb 6, 2024
@benjamincanac benjamincanac merged commit 10db144 into dev Feb 6, 2024
2 checks passed
@benjamincanac benjamincanac deleted the fix/1171 branch February 6, 2024 11:42
@hansemannn
Copy link

Amazing work, thank you @benjamincanac for being so responsive with community reports!

Copy link
Member Author

Of course! It took a bit of time but it wasn't possible to fix before Nuxt useId and Headless UI provideUseId.

@dosstx
Copy link

dosstx commented Feb 7, 2024

Does this mean we wait for the next Nuxt UI update or was there something we can do now? I don't mind waiting.

Copy link
Member Author

I'm not sure when I'll make a release yet but in the meantime, you can either keep the resolutions or use the edge package: https://ui.nuxt.com/getting-started/installation#edge

@dosstx
Copy link

dosstx commented Feb 7, 2024

That's right, I had forgotten about the edge channel. I can wait for the official release. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hydration attribute mismatch after update Nuxt to v3.9.0
4 participants