Repository navigation
fix(VVirtualScroll): keep measured sizes when items change - #23326
Open
cestercian wants to merge 3 commits into
Open
cestercian wants to merge 3 commits into
cestercian wants to merge 3 commits into
Conversation
Resetting every measured row when the list updates made the scroll height collapse to a short estimate, so the viewport jumped. Keep sizes for items that are still in the list. fixes vuetifyjs#21452
Contributor
|
Good playground. It shows the jump after [Prepend] is much less severe and scroll up is not having any jitter-like issues. I wonder if we can eliminate the move entirely. |
Inserting items above the viewport left scrollTop unchanged, so the visible row jumped. Restore it from item-key or identity, and compensate when a row above the viewport is measured.
Author
|
Yeah, the leftover move was scrollTop staying put when rows landed above the viewport. It now pins the first visible item by item-key (or identity) and shifts scrollTop by the size of the inserted rows, so Prepend should leave the anchored row where it is. Added a test for it too. |
A zero size estimate made the first measured row look like it sat above the viewport, so opening a select jumped scrollTop by one row.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
v-virtual-scrolldropped every measured row height whenever the items array changed. Anything not on screen then fell back to a short guess, the scroll height collapsed, and the list jumped.Sizes are kept for rows that are still there.
item-keyis used when it is set, otherwise the item itself.Fixes #21452
Markup: