react-component / react-component/tree

Virtualisation is not working on initial render when defaultExpandedKeys is set.

Open
#507 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
490
Avg merge
3d 17h
Merged PRs (30d)
5

Description

When defaultExpandedKeys prop is provided the virtualisation breaks. On debugging looks like the issue is originated from this line.

https://github.com/react-component/tree/blob/master/src/NodeList.tsx#L201

Where we are checking if expanded keys are changed, and if the changed keys length is only one. In all other cases it will not apply the virtualisation logic. I am assuming same thing will happen if expandedKeys prop is provided.

That logic breaks on initial render, as the prevExpandedKeys and expandedKeys will be same. Also, may fail when two items are expanded at once (programatically).

Can dive more into it, and raise a PR, before that wanted to get more context on the logic behind it.

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 src/NodeList.tsx around line 201 and trace how prevExpandedKeys and expandedKeys control virtualization. Reproduce the initial render with defaultExpandedKeys, then check the case where multiple items expand programmatically; done means virtualization remains correct in both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
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.