refactor: trigger range fetching before items reach viewport#9480
Draft
vursen wants to merge 5 commits into
Draft
refactor: trigger range fetching before items reach viewport#9480vursen wants to merge 5 commits into
vursen wants to merge 5 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`_updateScrollerItem` ran the fetch-range load whenever a column tree existed, triggering loads during non-scroll updates. Gate it on the scrolling state (`overscrollBehavior === 'auto'`) so the load only happens while the user is actually scrolling.
The web component renamed `_updateScrollerItem` to `__updateVirtualizerElement` and no longer toggles the `overscrollBehavior` style while scrolling. Hook the new method and use the scroller's `scrolling` attribute instead.
The fetch range is now clamped to the last valid index, so at the end of the grid the connector requests only the last existing page (count 50) instead of also a page past the end (count 100). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Clamping the range after expanding it to page boundaries could pull the end index off a page boundary near the last page. Clamp the buffer expansion instead, so the final range stays page-aligned.
cd3755c to
a8fc44a
Compare
|
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.



The grid web component fires a page request to the data provider only when a row from that page gets rendered in the DOM. Combined with the limited size of the viewport buffer, this often leaves the grid briefly showing lots of blank rows even when scrolling at a relatively slow speed, since pages can't load fast enough to keep up. Then, when the response arrives, many rendered rows get updated at once, triggering a heavy synchronous DOM update that blocks the event loop and has a negative impact on FPS. This effect got even more noticeable after vaadin/web-components#11196, which reduced the number of rendered rows outside the viewport. So while render time metrics improved after that fix, scroll frame time metrics regressed.
...
Before:
Before.mov
After:
After.mov
Depends on