-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
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
- clone the repo
npm run develop
- visit
http://localhost:8000
- inspect the browser console.
Describe your issue
The console logs the error:
Warning: Prop `id` did not match. Server: "headlessui-menu-button-:Rkp:" Client: "headlessui-menu-button-:R2j5:"
at button
at eval (webpack-internal:///./node_modules/@headlessui/react/dist/components/menu/menu.js:23:3867)
at C (webpack-internal:///./node_modules/@headlessui/react/dist/internal/open-closed.js:8:255)
at eval (webpack-internal:///./node_modules/@headlessui/react/dist/components/menu/menu.js:23:2487)
at MyDropdown
This occurs when Gatsby's DEV_SSR
flag is enabled in gatsby-config.js
, which causes server side rendering when the page is refreshed. It occurs with react@^18
, but not with react@^17
. It's probably related to https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/hooks/use-id.ts
I 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.