TanStack / TanStack/virtual

Uncaught Error: Maximum update depth exceeded. When we add styles for first row.

Open
#676 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.1k
Forks
466
Avg merge
2d 31m
Merged PRs (30d)
13

Description

Describe the bug

When virtualizing rows in @tanstack/table, if you add styles for the first row(:first-child) that change the height of the row and start scrolling, the calculation breaks down and the application crashes because it cannot calculate the height and goes into an infinity loop.

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-table-vduexv?file=src%2Findex.css

Steps to reproduce
  1. Add styles for the first row( tr:first-child { padding: 8px; or border: 1px solid lightgray; } )
  2. Start scrolling the table.
  3. An error has occurred.
Expected behavior

The application did not crash.

How often does this bug happen?

Every time

Screenshots or Videos
Снимок экрана 2024-02-22 в 11 33 20 AM
Platform

OS: macOS Browser: Chrome

tanstack-virtual version

v3.1.2

TypeScript version

No response

Additional context

No response

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

Run the linked StackBlitz reproduction and inspect src/index.css, beginning with the first-row styles that change the row height. Trace the virtualization measurement and scrolling behavior that follows the style change; done means the table continues scrolling without an infinite update loop or crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.