material-react-table icon indicating copy to clipboard operation
material-react-table copied to clipboard

Virtual Rows Blink When Rows Have Varying Heights On Scroll

Open scott-avery opened this issue 3 years ago • 12 comments

material-react-table version

0.33.6

Describe the bug and the steps to reproduce it

  1. Open https://www.material-react-table.dev/?path=/story/features-virtualization--enable-row-virtualization
  2. perform some scrolls on table.
  3. glitches occur.

Your Minimal, Reproducible Example - Sandbox (Recommended) or code snippets

https://www.material-react-table.dev/?path=/story/features-virtualization--enable-row-virtualization

Screenshots or Videos (Optional)

capture

capture2

Do you intend to try to help solve this bug with your own PR?

Maybe, I'll investigate and start debugging

Terms

  • [X] I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

scott-avery avatar Aug 09 '22 08:08 scott-avery

I'm exploring if I need to roll back to a previous beta version of @tanstack/react-virtual or even back to react-virtual v2 which did not have this problem

KevinVandy avatar Aug 09 '22 12:08 KevinVandy

as of v0.34.0, it has been rolled back to react-virtual v2.10.4 where the problem does not appear to exist. Something is off with the estimateSize or scrolling ref logic in v3.

KevinVandy avatar Aug 10 '22 03:08 KevinVandy

@KevinVandy I am afraid that issue still exists after rollback. Scroll more and you will find some rows flickering.

Both from online storybook and my local clone storybook.

My browser version is Chrome 104.0.5112.81.

scott-avery avatar Aug 10 '22 07:08 scott-avery

@KevinVandy I am afraid that issue still exists after rollback. Scroll more and you will find some rows flickering.

Both from online storybook and my local clone storybook.

My browser version is Chrome 104.0.5112.81.

By flickering do you mean that it takes a second for the new rows to fully render in? Or are you still seeing large up and down vibrations that never stop?

There might always be some delay in the rows rendering. The uncontrolled infinite bouncing up and down is what I'm hoping is solved now.

KevinVandy avatar Aug 10 '22 11:08 KevinVandy

@KevinVandy it's about the vibrations. It might be some calculation edge case in that library.

scott-avery avatar Aug 11 '22 02:08 scott-avery

@scott-avery I've tried to find the problem on v0.36.0 on a Mac, Windows PC, and Android phone, and don't see the vertical vibrations anymore on my storybook or docs site. I can re-open if it is confirmed to still be happening though.

More work in general is needed for virtualization performance. Really want to be able to use @tanstack/react-virtual v3 once this is figured out.

KevinVandy avatar Aug 14 '22 14:08 KevinVandy

I think I could reproduce it too. Easily with large row size. react-table

e-cloud avatar Aug 16 '22 15:08 e-cloud

Tried for hours to improve this, but it seems to be a flaw with react-virtual where when rows are differing heights are scrolled into and out of view at the same time cause this jitter. Slight improvements have been made by using some measureRefs internally, but the main fix is to ensure all rows have the same height. Setting a compact density state is one way to do that, since it sets whitespace: nowrap; internally on table cells.

KevinVandy avatar Aug 21 '22 18:08 KevinVandy

good job. I will also investigate how to improve it later.

scott-avery avatar Aug 22 '22 07:08 scott-avery

Good afternoon! Faced the same problem that lines "dance". But we also got lags when adding components, for example:

  • added enableExpanding
  • added export with checkboxes As I understand it, there is a constant rerender when scrolling and, accordingly, the more components, the more lags. Video with profiler enabled:

https://user-images.githubusercontent.com/42175541/192102312-932c00fa-82e3-4d9d-82df-36a638832374.mov

We managed to partially fix the lags by reducing the overscan: image

But as I understand it, as the components in the table increase, the lags will reappear. Memo in virtualized table does not help :(

AndreyGrek avatar Sep 24 '22 14:09 AndreyGrek

But as I understand it, as the components in the table increase, the lags will reappear. Memo in virtualized table does not help :(

That's kind of the nature of the beast. The more features you enable, and the more rows and columns you render at once, the lower the performance will be. I recommend using pagination in those instances.

It does appear that virtualization and row expansion don't play well together. Makes sense as any row height variation seems to confuse react-virtual

KevinVandy avatar Sep 24 '22 16:09 KevinVandy

It's so sad. But I'll still look for a solution, if I write something here or expose it to you PR

AndreyGrek avatar Sep 24 '22 17:09 AndreyGrek

Good News. This will be fixed in v1.4. Thanks in part to @AndreyGrek 's PR.

KevinVandy avatar Dec 08 '22 19:12 KevinVandy

@AndreyGrek @scott-avery @e-cloud For those of you still using this library, v1.4.0 now has addressed the major problems here. This should be fixed

KevinVandy avatar Dec 09 '22 00:12 KevinVandy