uber / react-digraph

A library for creating directed graph editors
MIT License
2.63k stars 268 forks source link

Expand peerDependencies range for react #336

Open mosofsky opened 2 years ago

mosofsky commented 2 years ago

Is your feature request related to a problem? Please describe.

Currently react-digraph 7.x and 8.x contain an old version of react as peer dependencies in their package.json, for example:

  "peerDependencies": {
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "d3": "^5.16.0"
  },

source: https://github.com/uber/react-digraph/blob/v8.0.0-beta.8/package.json

Describe the solution you'd like

Test with react 17 and if everything works, expand the range like this:

  "peerDependencies": {
    "react": "^16.12.0 || ^17.0.0",
    "react-dom": "^16.12.0  || ^17.0.0",
    "d3": "^5.16.0"
  },

This OR syntax is discussed at https://stackoverflow.com/questions/47309598/make-your-npm-package-support-multiple-versions-of-peer-depedency and there's a nice tool at https://semver.npmjs.com/ for verifying that it works.

Describe alternatives you've considered

The alternative is for me just to ignore the yarn install warnings I get and pray they're not a problem:

warning " > react-digraph@7.2.1" has incorrect peer dependency "react@^16.12.0".
warning " > react-digraph@7.2.1" has incorrect peer dependency "react-dom@^16.12.0".
warning " > react-digraph@7.2.1" has unmet peer dependency "d3@^5.16.0".

Additional context

React 17 was released on October 20, 2020 and the release notes are here https://reactjs.org/blog/2020/10/20/react-v17.html and more breaking changes are described at https://reactjs.org/blog/2020/08/10/react-v17-rc.html#other-breaking-changes . If none of these matter, then it would be great to expand the peerDependencies.

Jyrno42 commented 2 years ago

Been using the library with react 17 for a while now and have not encountered any issues. In fact I am now testing with react 18 and will let you know if there are any problems or not.

E: Everything we are doing seems to work nicely with react 18 too. Only problem is the ReactDOM.render deprecation warning being logged to the console.