pbeshai / use-query-params

React Hook for managing state in URL query parameters with easy serialization.
https://pbeshai.github.io/use-query-params
ISC License
2.16k stars 96 forks source link

Peer dependencies in version 2.2.1 #276

Open duncannz opened 1 year ago

duncannz commented 1 year ago

Version 2.2.1 adds a peer dependency on @reach/router: https://github.com/pbeshai/use-query-params/pull/261

However, @reach/router itself has not been updated in over 3 years, and has a peer dependency on "react": "15.x || 16.x || 16.4.0-alpha.0911da3" - i.e. it is not even compatible with React 17, let alone 18.

This causes errors running npm install for anyone trying to use React 17 or 18 with use-query-params version 2.2.1.

In my opinion, @reach/router which is clearly no longer an active project should not be added as a peer dependency, and it would possibly make sense to drop support altogether.

An example of the error that now occurs when running npm install:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vxt/web@0.0.0-changedDuringDockerBuild
npm ERR! Found: use-query-params@undefined
npm ERR! packages/web/node_modules/use-query-params
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! use-query-params@"^2.2.0" from @vxt/web@0.0.0-changedDuringDockerBuild
npm ERR! packages/web
npm ERR!   @vxt/web@0.0.0-changedDuringDockerBuild
npm ERR!   node_modules/@vxt/web
npm ERR!     workspace packages/web from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"15.x || 16.x || 16.4.0-alpha.0911da3" from @reach/router@1.3.4
npm ERR!   node_modules/@reach/router
npm ERR!     peerOptional @reach/router@"^1.2.1" from use-query-params@2.2.1
npm ERR!     node_modules/use-query-params
npm ERR!       use-query-params@"^2.2.0" from @vxt/web@0.0.0-changedDuringDockerBuild
npm ERR!       packages/web
npm ERR!         @vxt/web@0.0.0-changedDuringDockerBuild
npm ERR!         node_modules/@vxt/web
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
MichaelHefetz commented 1 year ago

We have the same issue. I use it with React 18. Just installed with --force flag. But, proper solution will be great. Thanks.

luigimannoni commented 5 months ago

Bump. Been using use-query-params just fine until like yesterday, but started to break lately as another package requires 2.2.1 :/