fix(grid): restore trailing scroll emission so top rows aren't lost after fast scroll - 21.2.x#17460
Open
Zneeky wants to merge 3 commits into
Open
fix(grid): restore trailing scroll emission so top rows aren't lost after fast scroll - 21.2.x#17460Zneeky wants to merge 3 commits into
Zneeky wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a regression in shared grid vertical scroll handling where fast momentum/inertia scrolling could leave virtualization out of sync with the scrollbar’s final resting position, causing top rows to appear missing.
Changes:
- Updates the
scrollNotifyRxJS throttling configuration to ensure the final (settling) scroll position is processed. - Adds inline rationale explaining why trailing scroll handling is required for virtualization correctness.
Drives the vertical scrollNotify stream with an intermediate (leading-edge) position followed by a scrollTop=0 settle in the same throttle window, so the settle can only be delivered on the trailing edge. Asserts the grid resets to startIndex 0 / renders row 0, guarding against the dropped-trailing throttle config that left the top rows frozen out of view.
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.
Closes #17287
Description
Fixes a regression where the top rows of
igx-grid/igx-tree-grid/igx-hierarchical-gridcould become invisible after a fast momentum/inertiascroll back to the top. The scrollbar reports
scrollTop ≈ 0, but thevirtualized rows stay frozen at an intermediate
startIndex(~row 10–15).The vertical-scroll
throttleonscrollNotifywas passing no config, so itused RxJS's default
{ leading: true, trailing: false }. The trailing edgeis what guarantees the final settle position of a scroll gets processed, so
without it the last events of a momentum flick (including the
scrollTop ≈ 0settle) were dropped. Restoring
{ leading: true, trailing: true }fixes thiswhile keeping the immediate leading-edge response.
Motivation / Context
The throttle originally used
throttleTime(THROTTLE_TIME, animationFrameScheduler, { leading: false, trailing: true }).When it was changed to a data-size–dependent
throttle(durationSelector)(in"feat(grids): Apply different throttle based on the amount of data in display"),
the config object was dropped and the operator fell back to the RxJS default
{ leading: true, trailing: false }.Without the trailing edge, the last scroll events of a momentum flick fall inside
a throttle window (up to 60 ms for large grids) and are discarded.
verticalScrollContainer.onScrollnever runs for the final position, sovirtualization stays at the last leading
startIndexwhile the DOM scrollbarsettles at the top → the top rows appear missing.
The fix keeps
leading: true(matching currentmaster, so timing-sensitivescroll/navigation tests are unaffected) and adds
trailing: trueto restore theguarantee that the final resting scroll position is always handled — a strict
superset of the current behavior. Independent of zone/zoneless change detection.
Backported to
21.2.xand22.0.x.