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

[USelectMenu] Hydration mismatch on root id #1368

Closed
FranciscoKloganB opened this issue Feb 18, 2024 · 2 comments
Closed

[USelectMenu] Hydration mismatch on root id #1368

FranciscoKloganB opened this issue Feb 18, 2024 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@FranciscoKloganB
Copy link

FranciscoKloganB commented Feb 18, 2024

Environment

  • Node Version - v20.10.0
  • Package Manager - npm@10.2.3
  • Nuxt Version - 3.10.3

Version

v2.13.0

Reproduction

https://stackblitz.com/edit/nuxt-ui-1cbn2x?file=app.vue,components%2Fcustom-select.vue

Description

According to the documentation of the <SelectMenu /> component defined here, it should be possible to set an ID property on on <SelectMenu />.

However, that documentation is not respected. Meaning that invoking the component as outlined below is equivalent.

  <!-- adds a custom identifier for trigger container, e.g.: 'foo-bar' -->
  <USelectMenu :id="id" v-model="current" :options="locales" by="code">
    <UButton>Foo Bar</UButton>
  </USelectMenu>
 <!-- does not define an identifier for trigger container -->
 <USelectMenu v-model="current" :options="locales" by="code">
   <UButton>Foo Bar</UButton>
 </USelectMenu>

As seen in the component implementation here it appears that id prop is not used on the root element. Which would explain a custom ID set externally by the consumer not showing up on the DOM.

Furthermore, not only are we not allowed to define an ID, this is causing hydration mismatches between client and server as outlined on the screenshots below.

Additional context

image
image

Logs

No response

@FranciscoKloganB FranciscoKloganB added the bug Something isn't working label Feb 18, 2024
@redcodemohammed
Copy link

I think I have the same issue here but with a different component, in my case, it's the Accordion,
image

I found out that the server doesn't reset it's counter when giving an id for elements when you refresh the page, so the client side always gives the element ids starting with 1, but on the server side, it increases with every refresh.

@benjamincanac benjamincanac added the duplicate This issue or pull request already exists label Feb 18, 2024 — with Volta.net
Copy link
Member

Duplicate #1171.

@benjamincanac benjamincanac closed this as not planned Won't fix, can't repro, duplicate, stale Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants