question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't unload rows when scrolling under certain situations

See original GitHub issue

If my list is 10000 items long, then react-virtualized works great! It loads fast with the downside that fast scrolling causes you to scroll past some blank rows until you slow down and let the renderer catchup. The blank rows are more pronounced if your rows are DOM heavy. This is a fine tradeoff.

What I noticed is that if my list happens to be only 100 items long, react-virtualized is overkill. So, I could look at the size of my list and if it’s long, render it using react-virtualized, and if it’s short rendering it without, but this adds a complex switch into my app. So, what I do instead is pass a big number to overscanRowCount if the list happens to be short. This causes it to render the whole thing from the start (which is a bit slower), but I don’t get any flickering when scrolling. It works pretty good.

I have an idea for getting rid of that “a bit slower” thing. Right now, if you scroll down, react-virtualized will load a row at the bottom and unload a row at the top. What if you added another prop like maxBufferRows that says how many rows to keep before unloading them? So, if I set this to 100, then react-virtualized would initially load (lets say) 20 rows and then as I scroll down it adds rows one by one until it gets to 100 and only then does it start unloading rows at the top.

This way, if I have a short list, I get the best of both worlds: Fast initial render, less flickering when scrolling. If I have a long list, then it works like a normal virtualized list.

I think I may be able to implement this by implementing a complex overscanIndicesGetter but I thought you might consider this for inclusion by default.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
offskycommented, Mar 24, 2017

Like you said, its easy enough to track the prev values myself. In case you change your mind:

https://github.com/offsky/react-virtualized/commit/dd6ad703a79a35a8de9c3d28aef1e372812d689a

0reactions
bvaughncommented, Mar 24, 2017

Hm… I don’t think I’m a fan of Grid passing in prev values FWIW. Seems better (and easy enough) to track in your callback function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Freeze panes to lock rows and columns - Microsoft Support
Select the cell below the rows and to the right of the columns you want to keep visible when you scroll. Select View...
Read more >
How to prevent overflow scrolling in CSS - LogRocket Blog
This article will discuss what an overflow scroll in CSS is, explain what causes this issue, and suggest ways to fix the problem,...
Read more >
How to disable scrolling in UITableView table ... - Stack Overflow
When the table fits on the screen, I'd like to disable scrolling, to make it a bit cleaner. But if the table goes...
Read more >
Scroll trouble in Excel (scrolling beyond your data)
Scroll Trouble in Excel? This post will show you how to make Excel "reset" the Scroll Bar in three different ways.
Read more >
3 Ways to Set Screen Scroll Lock Area in Excel
Worksheet or workbook protection does not lock the scroll unless you first ensure the cells outside the scroll area are locked and cannot...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found