react-component / react-component/table

开关展开行会重新渲染所有展开行

Open
#1,013 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.4k
Forks
618
Avg merge
10h 19m
Merged PRs (30d)
2

Description

https://github.com/react-component/table/blob/6f538dcc5511cacc89a494003b5b186581ccb87f/src/Body/BodyRow.tsx#L85-L97

目前是用一个set存的所有已展开行的key,然后到这里react就会重新渲染所有已展开的行,造成不必要的开销。是否应该将是否展开作为行数据的一个属性,配合key,react就可以做到精准更新这一行。

目前的方案还存在一个问题,数据源改变后 #mergedExpandedKeys并没有改变,当数据源重新变回来后又以展开状态渲染了表格。

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 by reading the linked section of src/Body/BodyRow.tsx and the mergedExpandedKeys logic in src/hooks/useExpand.ts. Reproduce expansion with a changed data source, then verify that toggling one row does not rerender unrelated expanded rows and that restored data does not regain an outdated expanded state.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.