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

Hydration warnings in development when visiting the dashboard application #2243

Closed
3 tasks done
unrenamed opened this issue Oct 7, 2024 · 6 comments · Fixed by #2253
Closed
3 tasks done

Hydration warnings in development when visiting the dashboard application #2243

unrenamed opened this issue Oct 7, 2024 · 6 comments · Fixed by #2253

Comments

@unrenamed
Copy link
Contributor

unrenamed commented Oct 7, 2024

Preliminary Checks

Reproduction / Replay Link (Optional)

No response

Issue Summary

The hydration error occurs because placing a <button> component as a descendant of another <button> violates HTML specifications. This can lead to unpredictable behavior during client-side rendering when the DOM structure expected on the client doesn't match the one rendered on the server.

Why it doesn't show in production?
In production, Next.js suppresses some warnings to improve performance, so you may not see the same error message, but the underlying issue still exists.

Is it critical?
Not crucial, but it's worth fixing, especially for avoiding potential rendering bugs. While it might not immediately break the app, unexpected behavior could surface across different browsers or when additional interactivity is introduced. Nesting interactive elements like buttons within each other can also confuse assistive technologies (e.g. automated UI tests).

Steps to Reproduce

  1. Visit any page of the dashboard app in development
  2. Open Console tab in DevTools
  3. See the following warnings:
In HTML, <button> cannot be a descendant of <button>. This will cause a hydration error.

Expected behavior

There is no hydration warnings in a DevTools console in development.

Other information

PR where the bug was found: #2218

Screenshots

Screenshot 2024-10-07 at 14 34 39 Screenshot 2024-10-07 at 14 40 41

Version info

- OS:
- Node:
- npm:
@unrenamed unrenamed added Bug Something isn't working Needs Approval Needs approval from Unkey labels Oct 7, 2024
Copy link

linear bot commented Oct 7, 2024

@chronark
Copy link
Collaborator

chronark commented Oct 7, 2024

/award 150

Copy link

oss-gg bot commented Oct 7, 2024

Awarding unrenamed: 150 points 🕹️ Well done! Check out your new contribution on oss.gg/unrenamed

@unrenamed
Copy link
Contributor Author

/assign

Copy link

oss-gg bot commented Oct 7, 2024

Assigned to @unrenamed! Please open a draft PR linking this issue within 48h ⚠️ If we can't detect a PR from you linking this issue in 48h, you'll be unassigned automatically 🕹️ Excited to have you ship this 🚀

Copy link

oss-gg bot commented Oct 9, 2024

@unrenamed, Just a little reminder: Please open a draft PR linking this issue within 12 hours. If we can't detect a PR in 12h, you will be unassigned automatically.

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

Successfully merging a pull request may close this issue.

2 participants