-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Erratic behaviour with onRangeChange while scrolling up #478
Comments
Hi, could you make a minimal reproduction? |
Hi @inokawa I've created an isolated electron app that's as close as possible to how the actual app functions. If possible, I'd like to share it privately. Could you let me know how I could do so? |
I want to chime in and say I've also been experiencing this, and I have some theories on what's causing it. When I trip the loader to load more, the load happens but the scroll has continued to move up during that same period (inertial scrolling?). Because I'm only appending 25 items to the head of the list, the visible range is immediately put back into the "go get more to load" state due to the upward momentum. I have a really weird fix where i basically timeout the ability to load more for 1.5s, and after a mutation and a @mrooding i think maybe you could be experiencing the same thing? |
@WalrusSoup that's interesting. Even without this bug I noticed that the range change event handler was firing very often so I already introduced a debounce function. That didn't seem to fix it for me though. Possible, manually moving the scroll position would fix it like you did. Would you be able to share an isolated example of your solution? @inokawa @WalrusSoup I've stripped the example app to the bare minimum of what my overall setup looks like: https://drive.google.com/file/d/1RiToR4mq0iitkQKbbg6vQ_DdDy7ubGEi/view?usp=sharing To reproduce:
|
Thanks! I'll take a look. |
Your application logic fetches new items in onRangeChange callback. Prepending items will change visible range so onRangeChange can be called infinitely if we don't have proper guard. So please consider adding guard. |
@inokawa thank you for the reply. What would a proper guard look like to you? |
Hi @inokawa I'd appreciate your input on this one. Thanks again |
Describe the bug
When using a Virtualizer with a list index component to jump to a specific point within the list, scrolling upwards really quickly after loading makes the scrollbar jitter. It continuously calls range change event handler until it reaches start index 0.
To Reproduce
Video: https://photos.app.goo.gl/j9SXEJGUyirVuCyY7
Expected behavior
It should just load the previous items once and not loop all the way back to 0
Platform:
Additional context
I'm trying to implement a virtual list that supports a list index component used for jumping to a specific index. Regular horizontal scrolling from the start of the list until the end works perfect.
After using the list index to jump to a specific offset, scrolling downwards to load higher index items works fine too. However, when scrolling upwards extremely fast seems to create a state where the scrollbar is stuck and a update loop is triggered which loads all the items until index 0 is reached.
I've tried using a normal
VList
instead of a Virtualizer (with scroll-ref) but that had the same effect. I've based my implementation on the feed exampleSimplified usage of the component:
The text was updated successfully, but these errors were encountered: