Skip to content
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

Support for React 19 #1364

Closed
rolandjitsu opened this issue Nov 16, 2024 · 13 comments · Fixed by #1367
Closed

Support for React 19 #1364

rolandjitsu opened this issue Nov 16, 2024 · 13 comments · Fixed by #1367

Comments

@rolandjitsu
Copy link

Describe the feature you'd like:

It would be nice if this lib supports React 19. It should probably work, but when using npm to install deps, it fails with:

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: react-dropzone@0.0.0-development
npm error Found: @testing-library/dom@8.11.3
npm error node_modules/@testing-library/dom
npm error   dev @testing-library/dom@"^8.11.3" from the root project
npm error
npm error Could not resolve dependency:
npm error peer @testing-library/dom@"^10.0.0" from @testing-library/react@16.0.1
npm error node_modules/@testing-library/react
npm error   dev @testing-library/react@"^16.0.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /Users/rolandgroza/.npm/_logs/2024-11-16T11_33_00_199Z-eresolve-report.txt
npm error A complete log of this run can be found in: /Users/rolandgroza/.npm/_logs/2024-11-16T11_33_00_199Z-debug-0.log
react-dropzone

Suggested implementation:

I guess relaxing the react version range should be enough if there are no other issues?

Describe alternatives you've considered:

I'm trying npm install --force.

Teachability, Documentation, Adoption, Migration Strategy:

@MatanBobi
Copy link
Member

The problem here is React RC version that isn't supported due to the way npm treats peer dependencies.
I'm not eager to add a peer dep for rc versions. Maybe @eps1lon will chime in with a different opinion?

@rolandjitsu
Copy link
Author

The problem here is React RC version that isn't supported due to the way npm treats peer dependencies. I'm not eager to add a peer dep for rc versions. Maybe @eps1lon will chime in with a different opinion?

Wouldn't extending the range to 19 + allowing 19 RCs work? Maybe it could be released on the next/beta channel so that we can use a pre-release of this lib with 19 RC allowed until 19 is stable?

@MatanBobi
Copy link
Member

Once React 19 will be released, our current peer dependencies range will include it. I don't think that pushing a new version of RTL is necessary just to support RC as long as using legacy-peer-deps is still an option and using a RC is not something that should be a best practice or a common pattern.

@rolandjitsu
Copy link
Author

Once React 19 will be released, our current peer dependencies range will include it.

Hmm, your current range for React stops at 18 (includes all minor and patches)

"react": "^18.0.0",

Or am I looking in the wrong place? Or misreading the use of ^?

I don't think that pushing a new version of RTL is necessary just to support RC as long as using legacy-peer-deps is still an option and using a RC is not something that should be a best practice or a common pattern.

I wasn't aware of the legacy-peer-deps flag. Still for downstream users of our package, installing without being aware of legacy-peer-deps is not possible. So we'd need to make that obvious somewhere. Also, using that flag may have unintended consequences.

But I guess for testing our lib (react-dropzone), the aforementioned flag is good enough.

@eps1lon
Copy link
Member

eps1lon commented Nov 21, 2024

Hmm, your current range for React stops at 18 (includes all minor and patches)

React 19 isn't released yet so there's nothing useful to put there.

@rolandjitsu
Copy link
Author

Hmm, your current range for React stops at 18 (includes all minor and patches)

Once React 19 will be released, our current peer dependencies range will include it.

I've only mentioned it because:

Once React 19 will be released, our current peer dependencies range will include it.

Which in my mind meant that this package needs no change to allow React 19 to be used without that peer deps error.

In any case, have you guys tested this lib with the latest pre-release of React? Or you don't think there're gonna be any issues and the transition will be seamless?

@eps1lon
Copy link
Member

eps1lon commented Nov 25, 2024

In any case, have you guys tested this lib with the latest pre-release of React? Or you don't think there're gonna be any issues and the transition will be seamless?

We automatically test it on pushes and PRs with latest Canary and Experimental release. Last time I looked, everything was fine and since then nothing related change so I'm confident it's working.

Which in my mind meant that this package needs no change to allow React 19 to be used without that peer deps error.

Why would it require no change? We currently don't list ^19.0 in the version range.

@rolandjitsu
Copy link
Author

Which in my mind meant that this package needs no change to allow React 19 to be used without that peer deps error.

Why would it require no change? We currently don't list ^19.0 in the version range.

Because @MatanBobi said:

Once React 19 will be released, our current peer dependencies range will include it. I don't think that pushing a new version of RTL is necessary just to support RC as long as using legacy-peer-deps is still an option and using a RC is not something that should be a best practice or a common pattern.

It literally says that the current peer deps range will include it. But maybe I misread the message.

@MatanBobi
Copy link
Member

It literally says that the current peer deps range will include it. But maybe I misread the message.

That was my misunderstanding, sorry about that.

@rolandjitsu
Copy link
Author

It literally says that the current peer deps range will include it. But maybe I misread the message.

That was my misunderstanding, sorry about that.

No worries. Just wanted to make sure I understood the current state correctly and wasn't looking in the wrong place.

@dimatteoCarlos
Copy link

npm i react-dropzone --legacy-peer-deps, this worked!

@justinwinslow
Copy link

Looks like the work got done but the release failed (https://github.com/testing-library/react-testing-library/actions/runs/12187127289/job/33997281908). Any idea of timeline for getting that resolved?

@MatanBobi
Copy link
Member

@justinwinslow support for React 19 was released as part of 16.1.0 which is available on npmjs, I'm not sure why the job failed:

https://www.npmjs.com/package/@testing-library/react?activeTab=versions

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 a pull request may close this issue.

5 participants