Virtual Table Scrolling Performance lag Issue with WebSocket real-time data updates

オープン
#1,204 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
28/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
react, typescript

調査の方向性

仮想テーブルの再現から始め、244-247行付近の BodyGrid.tsx を調査してください。そこでは itemProps.style がセルの再レンダリングを引き起こすと報告されています。複雑なセルと WebSocket による行の更新をテストしながら、React Profiler とブラウザーのパフォーマンスツールを使用してください。スクロールの遅延を特定して対処し、仮想スクロールの動作を後退させていなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

Reproduction link

https://ant.design/components/table#table-demo-virtual-list

Steps to reproduce
  1. Create a virtual table using rc-table's genVirtualTable
  2. Implement with complex cell nodes
  3. Load initial data with WebSocket real-time updates for certain rows
  4. 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

  1. Noticeable lag during vertical scrolling
  2. 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

  1. Root cause of cell re-renders:
  1. 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

  1. Issue persists across React 16 and React 18
  2. Frame rate stability during lag suggests DOM operations (reflow/repaint) may be the bottleneck rather than React rendering
  3. Current implementation follows antd usage patterns with rc-table's genVirtualTable
主要言語
TypeScript
スター
1.4k
フォーク
623
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

react-component/table のほかの issue

react-component/table の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。