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
fix: avoid infinite loop on scrollToBottom with unknown sized elements #248
Conversation
@ktsn This opens an issue of when you start scrolling up over the "skipped" items -- scrolling becomes jumpy. In your example change 50 to 500 and start scrolling up (if you go slower it will be more noticeable). I didn't go too much in depth code-wise, but I am guessing that when an item that has undefined height is found & calculated, items below it are pushed down. A potential fix would be that in case of scroll up, you push up items above it (it included). |
Ah I see. That's because the current RecycleView implementation doesn't expect size changes for elements which is upper position than active viewport. I'll look into the solution for it. |
Added a logic to avoid jumping contents by modifying scroll position when the upper items' size are changed. |
@ktsn after i use the script below
Seems like scroller "freeze" the scrolling, so no matter how i scroll inside the scroller but i found the scroll event hander which was register on DynamicScroller i also try to use u solution, but it just not works how can we solve this issue ? |
@hereiscasio Are you sure you are using fixed code on my branch? In that case can you provide a reproduction I can try? |
@ktsn and indeed, it not works let me try to prepare the reproduction link |
@hereiscasio If you mean you modified |
@ktsn thx !!! a wired error throw out after i use u branch error throw from u code at this line:
Can u fix that ? One more thing, when i scrolling up, |
Hi @ktsn after i dig-in the source code, And if i put any idea ❓
|
It will be great, if u can tell me why, although i can fix it now by using dirty hack |
What do you mean by that? This code is not in my diff.
Browser and reproduction? |
here it's : https://codesandbox.io/s/vue-with-vuetify-eagles-wfvdl plz try to scroll up, u will find the content "jump" but if u disable line 95, and enable line 96 & 103 then u can do the same thing again, i'm just curious why BTW this codesandbox already use u branch code |
Your reproduction url seems not correct. It does not use scroll to bottom and your references (line 94, 95, 102) look not pointing correct position. |
@ktsn Basically, below works well
But u will find jumping issue if u use below code
And actually, i have use
|
Thanks for finding it. I figured out the cause. It's because the |
@ktsn i'm just lucky to find this issue because i'm dev chat app but anyway, thx so much cheers |
@ktsn good job on the fix, but there is another thing I'm worried about. If i remember correctly, if you set Are you able to try this out? I might have a chance to later this weekend. |
The code handling scrollToBottom changed, do you still have the issue? |
Ah but it's actually a separated problem. I'll make another pull request later. |
fix #221
I've changed the termination condition to when the scrollTop value is not changed since the previous update.
Also added
requestAnimationFrame
during the loop because we need to wait delayed processing inRecycleView
after triggeringscroll
event and DOM update.To check the behavior the scroll to bottom example has been updated not to specify fixed size for each item.