tailwindlabs / tailwindui-issues

A place to report bugs discovered in Tailwind UI.
236 stars 4 forks source link

Simple, sign in and registration form #1489

Closed shrewdly-dev closed 1 year ago

shrewdly-dev commented 1 year ago

What component (if applicable)

Describe the bug Form is causing hydration errors in nextjs 13

Unhandled Runtime Error Error: Hydration failed because the initial UI does not match what was rendered on the server.

Warning: Did not expect server HTML to contain a

in
.

See more info here: https://nextjs.org/docs/messages/react-hydration-error

Component Stack form div div SignIn ./src/app/components/auth/signIn.js (16:90) div To Reproduce Steps to reproduce the behavior: On page load

Screenshots If applicable, add screenshots to help explain your problem.

Browser/Device (if applicable) Chrome , Edge

RobinMalfait commented 1 year ago

Hey, thank you for this bug report! 🙏

This was recently a bug in Next.js where multiple versions of React were loaded causing hydration mismatches. This bug has been fixed on the Next.js repo. If you bump the Next.js version to the latest version than this issue should go away.

Starting from the the simple sign-in and registration form component using Next version ^13.4.13 I was not able to run into the hydration mismatch.

You can apply the following steps to get to the latest version of Next.js:

  1. npm install next@latest
  2. rm -rf .next This is to ensure that no old/stale caches are present
  3. npm run dev

If, after bumping the version, this is still an issue for you. Could you attach a minimal reproduction that contains the bug so that we can take a look at what's going on?

Hope this helps!