table icon indicating copy to clipboard operation
table copied to clipboard

Infinite loop caused by combining virtual scroll and grouping

Open art0rz opened this issue 2 years ago • 3 comments

Describe the bug

I'm trying to combine virtual scrolling and row grouping, but it is causing an infinite loop.

Here is an example. Uncomment line 75 in main.tsx and you will see endless console messages and the browser tab will freeze.

Is there another way I should be combining these two features, or is this a bug? I couldn't find an example online that combines these two features.

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/elastic-mendeleev-3nqqhg?embed=1&file=%2Fsrc%2Fmain.tsx%3A75%2C32

Steps to reproduce

  1. Open https://codesandbox.io/p/sandbox/elastic-mendeleev-3nqqhg?embed=1&file=%2Fsrc%2Fmain.tsx%3A75%2C32
  2. Uncomment line 75

Expected behavior

Infinite loop does not occur

How often does this bug happen?

Every time

Screenshots or Videos

https://github.com/TanStack/table/assets/358661/865d1a1d-e995-4c94-a937-8419ca8b293e

Platform

Chrome, Arch Linux x64

react-table version

8.9.2

TypeScript version

No response

Additional context

react-virtual v2.10.4

Terms & Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] 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.

art0rz avatar Jun 23 '23 09:06 art0rz

I just came to report this, I'm experiencing this same problem. I'm using react-table v8.7.4 and react-virtual v2.10.4

focux avatar Jun 23 '23 18:06 focux

I am having the same issue, using the following versions "react-virtual": "^2.10.4", "react-table": "^8.5.15",

sonchau avatar Aug 15 '23 23:08 sonchau

I was having this same issue but no virtualizer. It came down to making sure the grouping state value was a stable reference (either a ref/memo or outside of the component function) and then the infinite loop stopped.

Zeddox avatar Sep 05 '24 17:09 Zeddox