Stash the key used by the previous data-join

Open
#292 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
frontend

Research direction

Start by reading the keyed data-join implementation in d3-selection and its tests for selection.data. The issue proposes storing each existing element’s key as node.key only when a key function is supplied, then using that stored key on a later join. Done means keyed joins no longer recompute keys for existing elements while preserving current join behavior.

Written by the indexing model from the issue text.

Description

One of the surprising things about the data join is that you have to recompute a new key for the existing elements. It’d be nice if we stashed the key (if one exists) as node.__key__, similar to how we stash data as node.__data__. That way you’d only need to compute the key for the data, not for the existing elements. This key would only be stashed in the cases where you pass a key function to selection.data.

Dominant language
JavaScript
Stars
571
Forks
283
Avg merge
7h
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from d3/d3-selection

All issues in d3/d3-selection

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.