TanStack / TanStack/table

unnecessary rerenders of every row and cell in examples/react/editable-data

Open
#4,794 20 comments 20 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
28.4k
Forks
3.6k
Avg merge
1d 14h
Merged PRs (30d)
10

Description

Describe the bug

Every time one cell is edited in the examples/react/editable-data example, the entire table rerenders. If a user wants to render a large amount of rows, this strategy will start getting slow. At 50 rows in the example it takes 14.4 milliseconds to rerender the whole table with basic data. I've narrowed the unstable reference down to cell.getContext().

Your minimal, reproducible example

https://github.com/TanStack/table/tree/main/examples/react/editable-data

Steps to reproduce
  1. Open react dev tools profiler
  2. Start profiling
  3. Click on a cell to edit it
  4. Click off the cell
  5. Stop the profiler
  6. Check the results
Expected behavior

Only the affected cell should rerender unless my other cells have a direct dependency on it. I've even tried creating memoized components all the way down to the cell.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Windows

react-table version

8.8.5

TypeScript version

No response

Additional context

If this is something the library doesn't support then I think there should be a documentation section on it describing the pitfalls of rendering a large amount of rows and/or using complex cells.

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Contributor guide

Open the contributing guide

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 in examples/react/editable-data and reproduce the edit flow with the React DevTools profiler. Trace the unstable cell.getContext() reference and determine whether the example or table behavior causes all rows and cells to rerender. Done means editing one cell no longer rerenders unrelated cells, with the profiling result verified on the example.

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.