jonasgeiler / svelte-tiny-virtual-list

A tiny but mighty list virtualization library for Svelte, with zero dependencies 💪 Supports variable heights/widths, sticky items, scrolling to index, and more!
https://svelte-tiny-virtual-list.jonasgeiler.com
MIT License
405 stars 23 forks source link

estimatedItemSize - details #9

Closed inzanez closed 9 months ago

inzanez commented 2 years ago

Hi

first of all, many thanks for that great component! :-) Works really nice and smooth.

I do have a question about the 'estimateItemSize' though: I was under the impression that this was used to calculate the total scroll-height. So,...that it should basically match itemCount * itemSize in case of equal height items.

If that's right, I also thought that this would prevent that growing scrollbar during scrolling. It seems that as items are being recomputed, my scrollbar grows. So I tried to use estimatedItemSize as described above. But that gives me another weird behavior (scrolling to the bottom after a few initial correctly scrolled items). So maybe I got that totally wrong,...:-)

jonasgeiler commented 2 years ago

In all honesty, I'm not actually sure what this property does. I've looked at both, my source code and the originaly react-tiny-virtual-list source code, and it's only used for calculation in getTotalSize . Although as soon as totalSize is set, this property is used instead and estimatedItemSize doesn't affect anything... My guess is, it helps with initial rendering and reducing content shift, but other than that, I'm very sorry... Can't really help you. You could try to open an issue here, but it doesn't seem to be actively maintained...

inzanez commented 2 years ago

Not to worry, I think I'll try to dig into this...:-)

jonasgeiler commented 2 years ago

Any updates on this? I'd like to close this issue. Let me know if you need any help!

inzanez commented 9 months ago

Of course,...I haven't found what exactly it does, so....I am ignoring it for now ;-)