Virtual Table Scrolling Performance lag Issue with WebSocket real-time data updates
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 28/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- react, typescript
- 領域
- frontend, performance
研究方向
從重現虛擬表格開始,檢查第 244-247 行附近的 BodyGrid.tsx,據報告 itemProps.style 會觸發儲存格重新渲染。在測試複雜儲存格和透過 WebSocket 進行的列更新時,使用 React Profiler 和瀏覽器效能工具;完成的標準是識別並解決捲動延遲,同時不導致虛擬捲動行為回歸。
由索引模型根據 Issue 內容生成。
描述
Reproduction link
https://ant.design/components/table#table-demo-virtual-list
Steps to reproduce
- Create a virtual table using rc-table's genVirtualTable
- Implement with complex cell nodes
- Load initial data with WebSocket real-time updates for certain rows
- Scroll the table vertically
What is expected?
Smooth vertical scrolling performance with virtual list implementation.
What is actually happening?
Implementation Details
import { genVirtualTable } from 'rc-table';
const RcVirtualTable = genVirtualTable(
(prev, next) => {
const { _renderTimes: prevRenderTimes } = prev;
const { _renderTimes: nextRenderTimes } = next;
return prevRenderTimes !== nextRenderTimes;
}
);
export default RcVirtualTable;
// Table
const Table = (props, ref) => {
const renderTimesRef = React.useRef<number>(0);
renderTimesRef.current = 1;
const virtualProps = { ref, _renderTimes: renderTimesRef.current };
return <RcVirtualTable {...props} {...virtualProps} />;
};
export default React.forwardRef(Table);
Actual Behavior
- Noticeable lag during vertical scrolling
- Using React Profiler with highlight feature shows:
- All rows re-render on each scroll with color yellow
- All cells re-render on each scroll with color yellow
This issue exists in both antd and rc-virtual-list demos
Investigation Findings
- Root cause of cell re-renders:
- Located in BodyGrid component
- Issue traced to: https://github.com/react-component/table/blob/master/src/VirtualTable/BodyGrid.tsx#L244-L247
- itemProps.style causing unnecessary re-renders even when not needed
- Additional observations:
- Commenting out the style prop prevents cell re-renders but scrolling lag persists
- Frame rate remains stable during scrolling
- Suggests possible CSS updates, reflow, or repaint issues
Potential Contributing Factors
- Complex cell node structure
- Subsequent WebSocket updates for specific rows
| Environment | Info |
|---|---|
| antd | 5.21.6 |
| React | 18.2.0 |
| System | macOS 14.6.1 |
| Browser | Chrome 130.0.6723.92 |
- Issue persists across React 16 and React 18
- Frame rate stability during lag suggests DOM operations (reflow/repaint) may be the bottleneck rather than React rendering
- Current implementation follows antd usage patterns with rc-table's genVirtualTable
- 主要語言
- TypeScript
- 星號
- 1.4k
- 分支
- 623
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
react-component/table 的其他 Issue
-
feat: expose onVirtualScroll on VirtualTable可能已有人在做 @GarethJin 於 44 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 35/100
react-component/table#1522 ·
-
Fixed-header tables force one getBoundingClientRect per column on every mount (ResizeObserver-driven MeasureCell)可能已有人在做 @rubenmarcus 於 65 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 42/100
react-component/table#1507 ·
-
rowExpandable does not work when dataSource has children field可能已有人在做 @nrps9909 於 99 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 50/100
react-component/table#1416 ·
-
難度 5/5 一週以上 新手友好度 30/100
react-component/table#1403 ·
-
難度 5/5 一週以上 新手友好度 15/100
react-component/table#1269 · 1 則留言 ·
查看 react-component/table 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
Chocobozzz/PeerTube#7901 ·
維護者通常 3 天內回覆
-
area:tools bug has repro
難度 2/5 1-3 小時 新手友好度 86/100
anthropics/claude-code#113984 ·
-
難度 2/5 1-3 小時 新手友好度 72/100
ehmpathy/declapract-typescript-ehmpathy#960 ·
維護者通常 1 天內回覆
-
area/web platform/windows type/bug version/v2
難度 2/5 1-3 小時 新手友好度 65/100
anomalyco/opencode#68237 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100