Skip to content

Commit 2f9a6c6

Browse files
committed
Implement #4678 (Fix #4676) in correct branch
1 parent 017b472 commit 2f9a6c6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Core/Components/DataGrid/FluentDataGrid.razor.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ public partial class FluentDataGrid<TGridItem> : FluentComponentBase, IHandleEve
429429

430430
private GridItemsProvider<TGridItem>? _lastAssignedItemsProvider;
431431
private CancellationTokenSource? _pendingDataLoadCancellationTokenSource;
432+
private bool _isFirstVirtualizeProviderCall = true;
432433

433434
private Exception? _lastError;
434435
private GridItemsProviderRequest<TGridItem>? _lastRequest;
@@ -889,9 +890,15 @@ private async Task RefreshDataCoreAsync()
889890
_lastRefreshedPaginationState = Pagination;
890891

891892
// Debounce the requests. This eliminates a lot of redundant queries at the cost of slight lag after interactions.
892-
// TODO: Consider making this configurable, or smarter (e.g., doesn't delay on first call in a batch, then the amount
893-
// of delay increases if you rapidly issue repeated requests, such as when scrolling a long way)
894-
await Task.Delay(100);
893+
// Skip the delay on the first call to avoid unnecessary lag on initial load.
894+
if (_isFirstVirtualizeProviderCall)
895+
{
896+
_isFirstVirtualizeProviderCall = false;
897+
}
898+
else
899+
{
900+
await Task.Delay(100);
901+
}
895902

896903
if (request.CancellationToken.IsCancellationRequested)
897904
{

0 commit comments

Comments
 (0)