svelte-virtual-list
svelte-virtual-list copied to clipboard
Viewport goes empty if scrolled down and items array changes.
So I decided to try to work with this component and add a filteredItems function that filters depending on some input.
It appears as though the viewport is not scrolled to the top when the items array changes which results in some weird behaviour. I have showcased it in this REPL
To reproduce, scroll down some hundreds of items and start writing something in the input field.
The solution is simple and I will make a PR.
I mucked about some and saw that a change to items was running refresh but relying on stale info, so I made the change to items reset start and end if they are now out of range. There may be some duplicate calls going on, but as a quick and dirty it seems to work: