Skip to content

Conversation

@eps1lon
Copy link
Contributor

@eps1lon eps1lon commented May 29, 2024

These may break in any React release which may result in blocking the ecosystem from seemlessly upgrading to new React releases.

We can use useId instead which is available since React 18.

Keep in mind that the whole hook is not safe in concurrent rendering. It increments render during render but only decrements in an effect cleanup. React may render multiple times before actually committing. The keys would leak in those scenarios (e.g. when a sibling suspends).

Closes #3167

These may break in any React release which may result in blocking the ecosystem from seemlessly upgrading to new React releases.

We can use `useId` instead which is available since React 18.
@vercel
Copy link

vercel bot commented May 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 29, 2024 1:45pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 29, 2024 1:45pm

No need to use `useStableCollectionKey` anymore
@RobinMalfait
Copy link
Member

Hey!

Thanks for the PR, I did inline the useId hook directly but apart from that everything looks good to me. Thanks!

@RobinMalfait RobinMalfait merged commit 3070ad9 into tailwindlabs:main May 29, 2024
@eps1lon eps1lon deleted the react-19-compat branch May 29, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incompatible with React 19 due to use of __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED

2 participants