Skip to content

[DataGrid] Skip debounce delay on first provider call when using virtualize#4678

Closed
JamesNK wants to merge 1 commit intomicrosoft:mainfrom
JamesNK:fix/datagrid-initial-load-performance
Closed

[DataGrid] Skip debounce delay on first provider call when using virtualize#4678
JamesNK wants to merge 1 commit intomicrosoft:mainfrom
JamesNK:fix/datagrid-initial-load-performance

Conversation

@JamesNK
Copy link
Copy Markdown
Member

@JamesNK JamesNK commented Apr 7, 2026

Fix FluentDataGrid initial load performance

Fixes #4676

Problem

ProvideVirtualizedItemsAsync unconditionally calls await Task.Delay(100) before every request, including the very first one on page load. This introduces an artificial 100ms delay before grid rows are displayed, even when the ItemsProvider callback is synchronous.

Solution

Added a _isFirstVirtualizeProviderCall boolean field that skips the debounce delay on the first call. Subsequent calls (e.g., during scrolling) continue to be debounced as before.

Also fixed a pre-existing IDE0048 build error (missing parentheses for clarity) on the same file.

Changes

  • FluentDataGrid.razor.cs: Skip Task.Delay(100) on the first ProvideVirtualizedItemsAsync call
  • FluentDataGrid.razor.cs: Add parentheses to EffectiveLoadingValue expression to fix IDE0048

Eliminates the unconditional 100ms Task.Delay in ProvideVirtualizedItemsAsync
on the first call, improving initial load performance for FluentDataGrid with
Virtualize=true and ItemsProvider. Subsequent calls during scrolling still get
debounced as before.

Fixes microsoft#4676
@JamesNK JamesNK force-pushed the fix/datagrid-initial-load-performance branch from 5ff9081 to eafab98 Compare April 7, 2026 07:47
@MarvinKlein1508 MarvinKlein1508 added this to the v4.14.1 milestone Apr 7, 2026
vnbaaij
vnbaaij previously approved these changes Apr 7, 2026
@vnbaaij vnbaaij changed the title fix: skip debounce delay on first virtualize provider call [DataGrid] Skip debounce delay on first provider call when using virtualize Apr 7, 2026
@vnbaaij vnbaaij enabled auto-merge (squash) April 7, 2026 09:09
@vnbaaij vnbaaij dismissed their stale review April 7, 2026 09:11

Not targeting correct branch

@vnbaaij vnbaaij disabled auto-merge April 7, 2026 09:11
@vnbaaij
Copy link
Copy Markdown
Collaborator

vnbaaij commented Apr 7, 2026

Hi @JamesNK please re-target this PR to go to the dev branch

vnbaaij added a commit that referenced this pull request Apr 7, 2026
@vnbaaij
Copy link
Copy Markdown
Collaborator

vnbaaij commented Apr 7, 2026

Rolled up into #4680. Thanks again for your contribution!

@vnbaaij vnbaaij closed this Apr 7, 2026
vnbaaij added a commit that referenced this pull request Apr 7, 2026
* Implement #4677 (Fix #4674) in correct branch

* Implement #4678 (Fix #4676) in correct branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants