react-component / react-component/table
Virtual Table Scrolling Performance lag Issue with WebSocket real-time data updates
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 618
- Avg merge
- 10h 19m
- Merged PRs (30d)
- 2
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the virtual table reproduction and inspect BodyGrid.tsx around lines 244-247, where itemProps.style is reported to trigger cell re-renders. Use React Profiler and browser performance tools while testing complex cells and WebSocket row updates; done means identifying and addressing the scroll lag without regressing virtual scrolling behavior.
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
- 28/100