bvaughn / react-virtualized

React components for efficiently rendering large lists and tabular data
http://bvaughn.github.io/react-virtualized/
MIT License
26.37k stars 3.06k forks source link

Grid and MultiGrid makes 2 render passes on simple scroll #1035

Closed pete-moss closed 2 weeks ago

pete-moss commented 6 years ago

I am using both Grid and MultiGrid and I am noticing that 2 render passes are made when doing a simple scroll by either clicking on the arrow caret in the scrollbar, or by calling Grid.scrollToCell({rowIndex: n}). Doesn't seem right, and since I already see fairly significant delays when scrolling with MultGrid (the rendering of the row/column header Grids lag behind), I am wondering this could be addressed.

aem commented 6 years ago

Hi Pete. Can you please provide us with a code example that demonstrates the scrolling delays you're seeing and a verification of the second render pass?

wuweiweiwu commented 6 years ago

The latency will probably be solved once I finish migrating Grid #1053.

The double render is only observed for Grid when the component initially mounts and also on scroll end.

For Multigrid you will see a "double" render because at any time, you are scrolling two grids either horizontally or vertically.

pete-moss commented 6 years ago

I hope I have done this right (first time trying to use codesandbox - sorry for being such a newbie), but here is a link that illustrates what I meant. https://codesandbox.io/s/3rz2q0m415 If you open the demo in a browser window and look at the console log, I am tracing each time we are rendering body cell (4, 0). If you do a simple scroll down, or single Arrow Down, I see 2 calls to render that cell. That implies that 2 render passes are being made. Does that make sense?

Regarding delays I see, it mostly occurs when I am using variable-height cells with CellMeasurer. I can certainly understand the performance issues since you have to render all cells in a row to determine row height. But I am poking since if there really is an issue with making 2 render passes, maybe if this could be solved, performance may improve.

wuweiweiwu commented 6 years ago

I'll have to double check. This should be in Grid. So I'm going to hold off until the rewrite is done. Which should be in the next week or so

HtmlRanger commented 5 years ago

Hi! Any progress on this issue?