react-component / react-component/tree

Node expansion via drag event misses to async load tree data

Open
#530 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

Status Quo

The tree component is expanding the tree node, if the user has dragged over the tree node for longer time.
Thus, the tree comonent is expanding this particular tree node, hence tree is showing the children of that tree node, as well.

Problem

The tree component does not ensure that the tree data is fetched, if lazy load is used, once the tree node is expanded via drag enter/over event.

Root cause

It seems only the expanded keys are updated and onExpand is getting called, see:
https://github.com/react-component/tree/blob/22c5ace87f7c27a452b444a63e1a927488525520/src/Tree.tsx#L565

Solution Proposal

The onNodeExpand function should be called in case of expansion via drag event, like it is done for keyboard navigation or mouse-click event, since this ensures the async load.

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 in src/Tree.tsx around line 565, then compare the drag expansion path with the keyboard-navigation and mouse-click paths that call onNodeExpand. Confirm that expanding a node through drag events also fetches lazy-loaded children; done means the async tree data loads after drag expansion, matching the other expansion interactions.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.