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.

List not showing enough elements when big differences in height

See original GitHub issue

This is a bit of a special and maybe even contrived case, at least to the extent I did it, but this could lead to mistakes in more reasonable examples aswell.

Virtuoso doesn’t really handle big differences in height very well, when there is a sudden decrease in size.

<Virtuoso style={{ width: '100%', height: '400px' }} overscan={400} totalCount={200} item={(index: number) => {
            return <div style={{height: (index < 100 ? 200 : 20)}}>test {index}</div>;
        }} />

Since the first 100 items have a height of 200 Virtuoso assumes that height for all elements to begin with and once you scroll down to the items with a height of 20 it does not render enough items to fill the viewport.

I’m not sure if I’m doing something wrong or this is simply a limitation of the list.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
petyosicommented, Jan 9, 2020

Got it, thanks for the repro steps!

0reactions
petyosicommented, Jan 11, 2020

Published 0.12.4 and updated the example with it. You can see how the shorter items are re-filled with new ones.

A property that can improve the behavior in this case is defaultItemHeight - something which I consider.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Making the height of list items in a row follow their largest height
You can see the book in the center needs more height space than the other two books in the same row because its...
Read more >
Sizing items in CSS - Learn web development | MDN
Understanding how big the different features in your design will be is important. So, in this lesson we will summarize the various ways...
Read more >
Index and View Tall Array Elements - MATLAB & Simulink
Index and View Tall Array Elements. Tall arrays are too large to fit in memory, so it is common to view subsets of...
Read more >
Make Windows easier to see - Microsoft Support
Learn how to make your Windows display easier to see using accessibility features ... If there's not enough contrast between the elements on...
Read more >
.height() | jQuery API Documentation
The value reported by .height() is not guaranteed to be accurate when the element or its parent is hidden. To get an accurate...
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