fix(grid): restore trailing scroll emission so top rows aren't lost after fast scroll#17455
Open
Zneeky wants to merge 3 commits into
Open
fix(grid): restore trailing scroll emission so top rows aren't lost after fast scroll#17455Zneeky 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
Restores the intended RxJS throttle trailing-edge behavior for grid vertical scroll handling in IgxGridBaseDirective, addressing a regression where virtualization could remain at an intermediate startIndex after momentum scrolling back to the top (scrollbar settles at ~0 but top rows remain missing).
Changes:
- Passes an explicit
{ leading: false, trailing: true }configuration to the vertical scrollthrottle(...)operator to ensure the final “settle” scroll position is processed. - Adds an inline code comment documenting the rationale and the user-visible failure mode being prevented.
Comment on lines
3695
to
3706
| this.scrollNotify.pipe( | ||
| filter(() => !this._init), | ||
| throttle(() => | ||
| this.throttleTime$.pipe( | ||
| take(1), | ||
| switchMap(time => timer(time, this.throttleScheduler)) | ||
| ) | ||
| ), | ||
| // `trailing: true` ensures the final settle position of a fast momentum | ||
| // scroll is processed; otherwise the last scroll events are dropped and the | ||
| // rows stay frozen at an intermediate startIndex while the scrollbar is at top. | ||
| { leading: false, trailing: true } | ||
| ), |
…m/IgniteUI/igniteui-angular into aahmedov/fix-grid-scroll-trailing
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
projects/igniteui-angular/grids/grid/src/grid-base.directive.ts:3707
- This bug fix changes scroll/virtualization behavior but is only manually tested. Please add a regression unit test that simulates a burst of
scrollNotifyevents within one throttle window and asserts the trailing (final) event is processed (e.g.,verticalScrollHandleris invoked with the last scrollTop near 0 and the rendered start index updates accordingly). This helps prevent future regressions if the throttle logic is changed again.
this.scrollNotify.pipe(
filter(() => !this._init),
throttle(() =>
this.throttleTime$.pipe(
take(1),
switchMap(time => timer(time, this.throttleScheduler))
),
// `trailing: true` ensures the final settle position of a fast momentum
// scroll is processed; otherwise the last scroll events are dropped and the
// rows stay frozen at an intermediate startIndex while the scrollbar is at top.
// `leading: true` keeps the immediate response on scroll start.
{ leading: true, trailing: true }
),
Comment on lines
+3702
to
+3706
| // `trailing: true` ensures the final settle position of a fast momentum | ||
| // scroll is processed; otherwise the last scroll events are dropped and the | ||
| // rows stay frozen at an intermediate startIndex while the scrollbar is at top. | ||
| // `leading: true` keeps the immediate response on scroll start. | ||
| { leading: true, trailing: true } |
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 }. Restoring the explicit{ leading: false, trailing: true }config ensures the final settle position ofa scroll is always processed.
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 — including
the
scrollTop ≈ 0settle at the top — fall inside a throttle window (up to 60 msfor large grids) and are discarded.
verticalScrollContainer.onScrollnever runsfor the final position, so virtualization stays at the last leading
startIndexwhile the DOM scrollbar settles at the top → the top rows appear missing.
trailing: truerestores the guarantee that the final resting scroll position isalways handled. Independent of zone/zoneless change detection.
Type of Change (check all that apply):
Component(s) / Area(s) Affected:
Grid, Tree Grid, Hierarchical Grid (shared
IgxGridBaseDirectiveverticalscroll handling / virtualization)
How Has This Been Tested?
Manual: Grid performance sample with 1000 rows — repeatedly wheel-scroll up/down
with momentum and confirm the grid always snaps back to row 0 at the top
(scrollbar at top ⇔ first row visible), where it previously froze around row
10–15.
Test Configuration:
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes