react-component / react-component/tree

Add `onLoadError` to handle error load

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

If there is a loading error and the user has set loadedKeys , onLoad cannot handle this situation and may cause infinity loop. Following is an example

Edit eloquent-feistel-7rmyb3

I notice onLoad function only be called when the promise is fulfilled. And the user can only cope with loadedKeys in loadData function when there is a loading error.

I wonder if it is possible to add an onLoadError prop to handler loading error situation, which is just like following

https://github.com/JialuGong/tree/blob/454c4de5639f8c00d9105017676403866162ea9b/src/Tree.tsx#L998-L1009

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 with the referenced Tree.tsx lines 998-1009 and reproduce the loading-error case in the linked CodeSandbox, focusing on loadedKeys, loadData, and onLoad. Done means the loading error can be handled through the proposed onLoadError prop without causing an infinite loop, with behavior matching the documented example.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.