Skip to content

refactor(grid): Removed scroll throttle for grid scrolls#16871

Open
rkaraivanov wants to merge 2 commits intomasterfrom
rkaraivanov/remove-throttle-for-grid-scrolls
Open

refactor(grid): Removed scroll throttle for grid scrolls#16871
rkaraivanov wants to merge 2 commits intomasterfrom
rkaraivanov/remove-throttle-for-grid-scrolls

Conversation

@rkaraivanov
Copy link
Member

No description provided.

@MayaKirova MayaKirova removed their request for review February 5, 2026 15:20
@ChronosSF
Copy link
Member

LGTM

@ChronosSF ChronosSF added ✅ status: verified Applies to PRs that have passed manual verification and removed ❌ status: awaiting-test PRs awaiting manual verification labels Feb 6, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the grid scroll throttling mechanism (and related test overrides) so scroll notifications are emitted without a throttle delay.

Changes:

  • Removed the SCROLL_THROTTLE_TIME injection token and its usage in IgxGridBaseDirective.
  • Removed throttleTime(...) from the scrollNotify pipeline.
  • Simplified multiple grid-related specs by dropping TestBed provider overrides for scroll throttling.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
projects/igniteui-angular/grids/grid/src/grid-base.directive.ts Removes configurable scroll throttling and the throttled scrollNotify RxJS pipeline stage.
projects/igniteui-angular/grids/tree-grid/src/tree-grid-summaries.spec.ts Removes SCROLL_THROTTLE_TIME test provider override.
projects/igniteui-angular/grids/tree-grid/src/tree-grid-multi-cell-selection.spec.ts Removes SCROLL_THROTTLE_TIME test provider overrides in multiple suites.
projects/igniteui-angular/grids/tree-grid/src/tree-grid-keyBoardNav.spec.ts Removes SCROLL_THROTTLE_TIME test provider override.
projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.virtualization.spec.ts Removes SCROLL_THROTTLE_TIME test provider override.
projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.navigation.spec.ts Removes SCROLL_THROTTLE_TIME test provider overrides.
projects/igniteui-angular/grids/grid/src/grid.master-detail.spec.ts Removes SCROLL_THROTTLE_TIME test provider override.
projects/igniteui-angular/grids/grid/src/grid.component.spec.ts Removes SCROLL_THROTTLE_TIME test provider override.
projects/igniteui-angular/grids/grid/src/grid-mrl-keyboard-nav.spec.ts Removes SCROLL_THROTTLE_TIME test provider override.
projects/igniteui-angular/grids/grid/src/grid-keyBoardNav.spec.ts Removes SCROLL_THROTTLE_TIME test provider override.
projects/igniteui-angular/grids/grid/src/grid-cell-selection.spec.ts Removes SCROLL_THROTTLE_TIME test provider override.

Comment on lines 112 to 115
import { I18N_FORMATTER } from 'igniteui-angular/core';

/**
* Injection token for setting the throttle time used in grid virtual scroll.
* @hidden
*/
export const SCROLL_THROTTLE_TIME = /*@__PURE__*/new InjectionToken<number>('SCROLL_THROTTLE_TIME', {
factory: () => 40
});


interface IMatchInfoCache {
row: any;
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the exported SCROLL_THROTTLE_TIME token is a breaking change for any consumers (including internal tooling) that configured grid scroll behavior via DI. Consider keeping the token for backwards compatibility (e.g., deprecated), or reintroducing an equivalent public/hidden configuration point so existing DI configurations don’t hard-break at compile time.

Copilot uses AI. Check for mistakes.
Comment on lines 3721 to 3725
this.scrollNotify.pipe(
filter(() => !this._init),
throttleTime(this.THROTTLE_TIME, animationFrameScheduler, { leading: false, trailing: true }),
destructor
)
.subscribe((event) => {
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With throttleTime(...) removed, scrollNotify will now emit on every scroll event, which can be extremely high-frequency and may significantly increase work during scrolling (virtualization, change detection, DOM measurements, etc.). If the goal is to remove the fixed delay but still prevent event floods, consider coalescing emissions to animation frames (e.g., scheduling/coalescing on animationFrameScheduler via an operator like auditTime(0, animationFrameScheduler) or similar) so behavior remains responsive without regressing scroll performance.

Copilot uses AI. Check for mistakes.
@MayaKirova
Copy link
Contributor

@ChronosSF I'm against just removing it. Then we'd have almost no performance gain with large number of rows/cells on scroll.

I'd prefer if you give more information on the exact scenario you have tested/measured against and the issue you have with the throttle in them so that we may discuss a throttle variation that works for. Some options we have discussed with @rkaraivanov are:

  • Have a smaller throttle.
  • Have a throttle that depends on the number of rows/cells that need to render (i.e. 0 for a very small grid, but more for grids with larger sets of rows/cells that need to update on each scroll.)
  • Use animationFrameScheduler since it might "feel" smoother.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

grid virtualization ✅ status: verified Applies to PRs that have passed manual verification ❌ do not merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants