Repository navigation
Closed
Labels
community:contributionIssue will/can be addressed by community contributionstatus:needs-investigationNeeds additional investigation
Milestone
Description
I'm using a FluentDataGrid with ItemsProvider and Virtualize=true.
I noticed there is a delay between the grid header being displayed and grid rows being displayed. The ItemsProvider callback isn't async. I would expect data to be displayed immediately.
I investigated and noticed that the ItemsProvider is always called multiple times on page load. And I noticed the second call is behind a Task.Delay:
fluentui-blazor/src/Core/Components/DataGrid/FluentDataGrid.razor.cs
Lines 891 to 912 in 0625bb0
| // Debounce the requests. This eliminates a lot of redundant queries at the cost of slight lag after interactions. | |
| // TODO: Consider making this configurable, or smarter (e.g., doesn't delay on first call in a batch, then the amount | |
| // of delay increases if you rapidly issue repeated requests, such as when scrolling a long way) | |
| await Task.Delay(100); | |
| if (request.CancellationToken.IsCancellationRequested) | |
| { | |
| return default; | |
| } | |
| // Combine the query parameters from Virtualize with the ones from PaginationState | |
| var startIndex = request.StartIndex; | |
| var count = request.Count; | |
| if (Pagination is not null) | |
| { | |
| startIndex += Pagination.CurrentPageIndex * Pagination.ItemsPerPage; | |
| count = Math.Min(request.Count, Pagination.ItemsPerPage - request.StartIndex); | |
| } | |
| GridItemsProviderRequest<TGridItem> providerRequest = new( | |
| startIndex, count, _sortByColumn, _sortByAscending, request.CancellationToken); | |
| var providerResult = await ResolveItemsRequestAsync(providerRequest); |
Ideally there shouldn't be:
- Multiple calls to ItemsProvider (it doesn't matter much in my case because the data isn't that large or async)
- A forced 100ms delay before items are displayed.
Metadata
Metadata
Assignees
Labels
community:contributionIssue will/can be addressed by community contributionstatus:needs-investigationNeeds additional investigation
Activity
fix: skip debounce delay on first virtualize provider call
fix: skip debounce delay on first virtualize provider call
Fix #4676 for V5
Implement #4678 (Fix #4676) in correct branch
Fix #4676 for V5 (#4679)