-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
SSR error with <Menu.Button>: Prop id
did not match.
#1961
Comments
This happens in Next.js too (v13.0.3, React v18.2.0). |
same in Remix |
It looks like this was fixed in react here: facebook/react#25713 It doesn't look like there are any major react releases following this fix. Can anybody give guidance on how to work around this using canary or other releases of react? |
Nice find @dmexs Looks like you can do something like |
What package within Headless UI are you using?
@headlessui/react
What version of that package are you using?
v1.7.3
What browser are you using?
Chrome
Reproduction URL
https://github.com/ShaunDychko/headlessui-reproduce-menu-button-error
To reproduce
npm run develop
http://localhost:8000
Describe your issue
The console logs the error:
This occurs when Gatsby's
DEV_SSR
flag is enabled ingatsby-config.js
, which causes server side rendering when the page is refreshed. It occurs withreact@^18
, but not withreact@^17
. It's probably related to https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/hooks/use-id.tsI believe this causes React to re-render the page, which is consequential since it clears the cache from RTK Query and causes dynamic UI elements to flash between states while they're waiting for server data.
The text was updated successfully, but these errors were encountered: