mgechev / mgechev/react-reorderable

Key generation

Open
#13 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
62
Forks
16
PR merge metrics
No merged PRs in 30d

Description

The way the key for each item is being generated is not ideal as it uses the index of the item.

If you remove an item from the list, all the item DOM elements below that item in the list are removed and re-inserted as their index changes by -1 (not just re-rendered and compared against the virtual dom, they are actually removed and re-added (because of the key) which is a costly operation when you have a lot of elements).

The same is true if you re-order the source list, the component should be able to keep track of the objects between renders, regardless if one is removed or reordered in the source list.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start at the component's list-rendering and key-generation logic described in the issue. Check how removing and reordering source items affects existing DOM elements; done means items retain stable identity without unnecessary removal and reinsertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.