Closed nikolasrh closed 2 years ago
To properly support React 18 we need to use the flushSync
API. https://reactjs.org/docs/react-dom.html#flushsync
Wrap the setState
call with this:
import {flushSync} from 'react-dom';
Also I guess we need to do it in the render props API too
Will this break support for React 16.8 and 17?
Do you know if flushSync
is available in previous versions of react-dom
?
And react-dom
should be added as a peer dependency?
flushSync
existed since React 16.8 apparently (legit had no idea lol, I thought it was part of React 18)
You can check the exports for React 16.8 on unpkg to see (that's what I did)
Maybe we should split it up in seperate PRs? I can drop the commit about React 18 as peer dependency.
I just discovered floating-ui
😁
Maybe that's where I should be heading for React 18 support?
Dropped commit for React 18 support.
A lot of projects have a dependency on react-popper
so it would be good to support React 18 (and it's not too difficult). You can make a new PR with just that setState and peer dep change
But yeah! Floating UI is actively being developed while Popper is not. Therefore for new projects it's a good choice
@FezVrasta Will you have time to review this?
How's this different than https://github.com/floating-ui/react-popper/pull/440?
I will not be following up this PR since we are switching to floating-ui
. Do with it as you want.
As a last change I have rebased master to this branch to integrate with #440 and #441 and removed @testing-library/react-hooks
.
@testing-library/react
to 13, but still kept @testing-library/react-hooks
which is now available through @testing-library/react
. It would be nice if someone with more experience with act
and waitFor
would look over the changes in https://github.com/floating-ui/react-popper/pull/439/commits/23d553e87b6383b260d8f727934bb85503c653beAfter upgrading to React 18, yarn install
gives a peer dependency warning on @react-spring/web
, but the animations in
yarn run demo:dev
still seems to be working fine.
yarn install v1.22.18
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @react-spring/web@9.4.4" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
warning " > @react-spring/web@9.4.4" has incorrect peer dependency "react-dom@^16.8.0 || ^17.0.0".
warning "@react-spring/web > @react-spring/animated@9.4.4" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
warning "@react-spring/web > @react-spring/core@9.4.4" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
warning "@react-spring/web > @react-spring/shared@9.4.4" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
All dependencies that support React 17 have been updated. See commit messages for details about deprecated packages or link to upgrade guides.
React 18 has been added as peer dependency, but it has not been tested.I have tested the build and the demo application, but not the built JavaScript files in thedist
folder.This PR doesn't include a version change.
Yarn status
Upgrading dev dependencies to React 18
This needs to be resolved in order to upgrade to React 18:
@testing-library/react
13 only supports React 18. Version 12 only supports React 17 and below.@testing-library/react-hooks
will not support React 18 since it will be integrated into@testing-library/react
one day