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

Phase out d3 #3834

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft

Phase out d3 #3834

wants to merge 5 commits into from

Conversation

knolleary
Copy link
Member

Node-RED has used D3 since day one of its existence. The original structure of the view code was based on a D3 example (can't track down the actual one, but was similar to https://observablehq.com/@d3/force-directed-graph).

Whilst it has remained quite fundamental to how view.js works, there is something to be said for phasing out its use. There are optimisations we can make in the code if we aren't having to work in the d3 way.

We're also on an ancient version of d3. Faced with the choice of phasing out its use, or upgrading across multiple major version changes, I want to explore the former.

This PR is a work-in-progress towards that goal.

There are a handful of places where we use d3 for no reason other than it was convenient at the time - and vanilla javascript is more than good enough. That's where I'll start.

@coveralls
Copy link

coveralls commented Aug 5, 2022

Coverage Status

Coverage remained the same at 68.193% when pulling 11a6925 on phase-out-d3 into 30ea300 on dev.

@knolleary
Copy link
Member Author

Current occurrences of d3.

  • js/settings.js - 1 reference - logging d3.version - trivial to remove once we get rid of the rest
  • js/ui/palette.js - 1 reference. Part of link splicing - uses the data() function map the hovered dom element back to the actual link data element. Once we figure out how we want to replace d3 in view.js this functionality will need to be taken into account.
  • js/ui/view-navigator.js - 7 references. Uses the select/enter/exit functionality to generate the mini-map view.
  • js/ui/view.js - 253 references - ha ha ha. That's going to be some work.

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.

None yet

2 participants