KevinVandy / material-react-table

A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript
https://material-react-table.com
MIT License
1.46k stars 418 forks source link

Table rows disappear when toggling full screen #259

Closed evitalv closed 1 year ago

evitalv commented 1 year ago

material-react-table version

v1.4.3

react & react-dom versions

18.2.0

Describe the bug and the steps to reproduce it

When using infinite scrolling, toggle the table to full screen and then toggle back. Only the first five rows will be displayed.

Minimal, Reproducible Example - (Optional, but Recommended)

This is reproducible on the official site: https://www.material-react-table.com/docs/examples/infinite-scrolling

Screenshots or Videos (Optional)

No response

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

No, because I don't know how

Terms

KevinVandy commented 1 year ago

This seems to be a bug with TanStack Virtual measuring the table body at the wrong time. I'll have to look into this. Good thing it only happens when enableRowVirtualization is true

KevinVandy commented 1 year ago

The solution for this is to increase the overscan of the virtualizer.

if using MRT v1.5 or later: rowVirtualizerProps={{ overscan: 10 }}

if using MRT v1.4 or earlier: virtualizerProps={{ overscan: 10 }}

evitalv commented 1 year ago

This doesn't really work for me. When I set overscan to 10, I see 11 rows when exiting full screen, but when I scroll lower (below the first 11 rows) there's just emptiness. If I set overscan to 20 I get 21 rows and then nothing.

KevinVandy commented 1 year ago

This doesn't really work for me. When I set overscan to 10, I see 11 rows when exiting full screen, but when I scroll lower (below the first 11 rows) there's just emptiness. If I set overscan to 20 I get 21 rows and then nothing.

Hmm in my experience, after scrolling a bit more, it loads all the new rows

KevinVandy commented 1 year ago

@evitalv This is fixed for real this time in v1.5.7