-
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
React 18 compatibility tracking issue #681
Comments
Just ran into this, took me a while to trace down! I was seeing a bug in my app - There are no focusable elements inside the . Here's a repro: https://codesandbox.io/s/headless-ui-react-dialog-react-alpha-pvmd3?file=/src/App.js Next + react alpha + latest headlessui + strict mode. Clicking the button shows the error - remove strict mode and it works. |
I'm also seeing this using strict mode and React 18 RC. Can't use the |
Yeah, seems to be an issue with React 18 + strict mode. Disabling strict mode solves the issue for now. |
Now that React 18 is out, I think it's time to bump this issue :D |
I think it'd be good to pin this issue now that React 18 is out. Maybe also put a note somewhere on https://tailwindui.com/? I spun up a new Next.js project yesterday and just spent a while debugging why some of my Tailwind UI components were broken 😅 |
React 18 seems to have broken npm install with peer dependencies:
EDIT: My bad, if you see this error, then you probably only have |
It's breaking again, react 18 is out now please make this issue a high priority one 🙏🏻 |
Not sure how this can be circumvented considering it's the default behaviour of Strict Mode since React 18. We decided to disable Strict Mode for now, but would obviously prefer to keep it enabled. The announcement says the component will have all of its previous state when it gets remounted, so maybe there is some kind of workaround.
Also please do keep in mind this only affects development environments, as Strict Mode doesn't run in production mode. |
Can confirm this is also breaking in |
Work around
|
https://github.com/facebook/react/blob/main/CHANGELOG.md#breaking-changes Here if we have a look at the Strict Mode section, they talk about Which I think just means that it remounts again with the state from the previous unmount. |
Please comment here when it's updated. |
so that Transition works with React 18 (see tailwindlabs/headlessui#681)
so that Transition works with React 18 (see tailwindlabs/headlessui#681)
so that Transition works with React 18 (see tailwindlabs/headlessui#681)
Without strict mode, next js latest in dev mode, the select menu doesn't show all the items. Going to production mode makes it work again. |
@samselikoff I've updated your CodeSandbox using the latest insiders build which should fix React 18 issues. https://codesandbox.io/s/headless-ui-react-dialog-react-alpha-forked-feooky Thanks for reporting! |
Any word when we will get a release for this? |
Works for me with react 18 with Is this stable enough for production, or should I revert back to |
i think, swtich off StrictMode on dev & prod. and we just wait until headless updates for react v18! |
+1 please to putting a notification on tailwindui.com -- not a super great experience as a paying member for that product to have something not work out of the box. thanks! :) |
@RobinMalfait I'm getting this in insiders version 😕 |
Hey @bigint, it looks like it is erroring on |
Looks like version 1.6.0 was released a couple hours ago including fixes for React 18. Thanks @RobinMalfait and team! |
There is a problem with
Reverting back to |
@M1ck0 can you open a new issue with a reproduction repo / CodeSandbox attached? Hard to debug otherwise. |
Update!
We've applied some fixes in #1326, if you are running into React 18 issues please install the insiders build to see if your issues go away:
npm install @headlessui/react@insiders
yarn add @headlessui/react@insiders
.If you are still running into React 18 related issues, please open a new issue with a reproduction repo attached so that we can tackle those issues as well.
What package within Headless UI are you using?
@headlessui/react
Describe your issue
Now that React 18 is out, it looks like some people are running into issues. This is because of
StrictMode
in React that does a few extra things to ensure that your library works with Suspense.Currently it looks like all our components work fine with React 18, except for the
Transition
component. It just happens that a lot of people use this component in combination with other components like ourMenu
orListbox
components.We are aware of the issues and are working on fixes.
In the meantime, if you need React 18 support, then you can temporarily disable
StrictMode
. If you are using something like Next.js, then you can disable it like this:This workaround is a temporary solution so that you can move forward with your work.
StrictMode
is a development tool anyway and we are working hard to have compatibility with React 18 really soon.Edited: 5th of April, 2022
The text was updated successfully, but these errors were encountered: