Repository navigation
[DataGrid] Clear the force-refresh flag before calling RefreshItems - #5490
Merged
Denis Voituron (dvoituron) merged 2 commits intoOct 21, 2026
Conversation
RefreshDataCoreAsync cleared _forceRefreshData only after RefreshItems returned. When RefreshItems sets Loading and re-renders the grid, as the remote data sample does, OnParametersSetAsync refreshes again while the flag is still set and RefreshItems is called again. Clear the flag before the call, as v4 does. Fix microsoft#5487
Nurullah Türkoğlu (nurullahturkoglu)
requested review from
Denis Voituron (dvoituron) and
Vincent Baaij (vnbaaij)
as code owners
October 20, 2026 19:15
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The targeted fix addresses both callback paths, and the regression test covers the reported failure.
No open issues 🎉
What changed in this PR
Fixes #5487 by preventing repeated remote-data requests during forced DataGrid refreshes.
Changes:
- Clears the force-refresh flag before invoking
RefreshItemsin both branches. - Adds a regression test for re-rendering while loading.
| File | Description |
|---|---|
| tests/Core/Components/DataGrid/FluentDataGridTests.razor | Tests that loading re-renders do not trigger extra refresh callbacks. |
| src/Core/Components/DataGrid/FluentDataGrid.razor.cs | Resets the force-refresh flag before callback invocation. |
Review effort: Balanced
Author
|
@microsoft-github-policy-service agree |
Denis Voituron (dvoituron)
approved these changes
Oct 21, 2026
This was referenced Nov 16, 2026
Merged
Closed
This was referenced Nov 30, 2026
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.
Pull Request
📖 Description
RefreshDataAsync(force: true)sets_forceRefreshData, butRefreshDataCoreAsynconly cleared it afterRefreshItemsreturned. The remote data sample withRefreshItemssetsloading = trueand callsStateHasChangedinsideRefreshItems. That re-renders the grid, and becauseLoadingis true,OnParametersSetAsynccallsRefreshDataCoreAsyncagain while the flag is still set, soRefreshItemsruns again. Each call starts the next one, which gives the repeated or endless backend calls described in #5487.v4 clears the flag before it invokes
RefreshItems(since #3423, kept in #3927). The v5 port in #3915 moved the reset after the call. This PR restores the v4 order. It's a bug fix with no breaking change.🎫 Issues
Fix #5487
👩💻 Reviewer Notes
Only the forced path was affected. Without force,
_lastRequestis set before the call, andIsSameRequestalready stops the re-entrant call.📑 Test Plan
I added
FluentDataGrid_RefreshDataAsync_ForceRefresh_RerenderWhileLoading_CallsRefreshItemsOnce. ItsRefreshItemsre-renders the grid withLoading = true, like the sample. Without the fix,RefreshItemsis called 10 times, which is the limit the test sets, instead of 2. With the fix it is called twice: once for the initial load and once for the forced refresh.I ran all of
tests/Core(net10.0, macOS arm64): 4904 passed, 0 failed. I didn't run the demo app in a browser.✅ Checklist
General
AI contribution declaration
AI assistance is allowed; fully AI-generated or autonomous pull requests without meaningful human review are not accepted. See the AI contribution policy.
Component-specific