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

d3 v7 support #380

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

lironhl
Copy link
Contributor

@lironhl lironhl commented Oct 8, 2020

closes #365, This PR adds support for d3 v6!

Resources

  1. selection.datum function.
  2. drag.on function
  3. d3 v6 changes.

@lironhl
Copy link
Contributor Author

lironhl commented Oct 15, 2020

@danielcaldas Is the README.md treated like DOCUMENTATION.md? Should I discard my changes to README.md?

Copy link
Owner

@danielcaldas danielcaldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome that you tackle this one @lironhl 👍 Let's further discuss these changes, and see if we can keep backward compatibility with d3 v5

README.md Outdated Show resolved Hide resolved
package-lock.json Show resolved Hide resolved
@@ -181,7 +181,10 @@ export default class Graph extends React.Component {
.on("end", this._onDragEnd);

d3Select(`#${this.state.id}-${CONST.GRAPH_WRAPPER_ID}`)
Copy link
Owner

@danielcaldas danielcaldas Oct 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the changes are minimal would that be a way of:

  1. Use duck typing (or similar mechanism) to infer at runtime the d3 version that the client is using
  2. Based on the version determined in step 1., use the proper APIs for d3Select and other affected integration points.

If the above is not possible, we could potentially consider the following:

  1. Add a new config to graph.config.js where the user can specify the major version of d3 used.
  2. Use the client-defined config.d3MajorVersion property to adapt our integration points with d3.

I would like to keep retro compatibility with d3 v5 if possible 🙏 . If we see this is too much trouble, I'll consider a major release of react-d3-graph so that we can upgrade our peer dep. on d3 to v6.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielcaldas This is probably not that hard to do, the code will look something like this:

import { ..., event as d3V5Event } from "d3-selection";

// code

_zoomed = d3V6Event => {
    const d3Event = d3V5Event || d3V6Event;
    // code
}
  1. I think supporting d3 v5 will definitely increase the code complexity in this package.

  2. As you said the changes were minimal, so the users of our package won't have a hard time migrating, plus I don't think
    that the vast majority of our users, implemented a complex d3 logic, outside of our package, which means they'll only need to update their dependency in the package.json to migrate to the next react-d3-graph major release.

  3. It'll take a considerable effort to support both of the d3 versions, and I don't think d3 maintainers are going to support the d3 v5 anymore (with bug fixes, features, etc), so we'll put an effort into a d3 version which may not be in the best condition over time.

I think you should consider a major release, anyway let me know what you think about what I wrote, If we'll get to the conclusion that we should support d3 v5 I'll gladly add the support for it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes total sense, I'm considering pushing this awesome change of yours in a release candidate version for react-d3-graph@3.0.0 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielcaldas I think releasing react-d3-graph@3.0.0, with this PR and my other PRs (#379 and #378), is a great choice 😆

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lironhl Let's focus on the others first. They're not breaking changes; hence we can still release them within a 2.x version. The strategy would be to get as much stuff as possible compatible withing 2.x. Thanks for the awesome work 👏

@rhp4515
Copy link

rhp4515 commented May 5, 2021

Whats the ETA for this release @danielcaldas ?

@lironhl lironhl changed the title D3 v6 support D3 v7 support Aug 9, 2021
@lironhl
Copy link
Contributor Author

lironhl commented Aug 9, 2021

@danielcaldas @antoninklopp guys a whole new major version of d3 was released and this PR wasn't merged 😆.

Resources for this PR

--env=jsdom
rename to babel.config.js, jest doesn't recognize .babelrc for some reason.

Copy link
Collaborator

@antoninklopp antoninklopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks great to me @lironhl !
@danielcaldas, I think that we should start planning for a v3 release (since you suggested that this change would be part of a v3) as a lot of people might already have moved to d3 v6 and it contains breaking changes for react-d3-graph

We might want to start with a beta?

docs/DOCUMENTATION.md Outdated Show resolved Hide resolved
@lironhl lironhl changed the title D3 v7 support d3 v7 support Aug 21, 2021
vpanfilov added a commit to vpanfilov/react-d3-graph that referenced this pull request Dec 30, 2021
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 this pull request may close these issues.

Support for d3 v6
4 participants