-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix multiple requests for ItemsProvider when changing the TotalItemCount #64661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request fixes a pagination state tracking issue in the QuickGrid component that was causing unnecessary data refreshes when filters changed the TotalItemCount. The fix ensures that the pagination state hash is updated only after data loads complete successfully, preventing premature state tracking that could trigger redundant refresh cycles.
Key changes:
- Moves
_lastRefreshedPaginationStateHashassignment to after data load completion in the non-virtualized path - Adds comprehensive E2E tests to verify single ItemsProvider calls when filtering via pagination reset or explicit refresh
- Introduces a new test component to simulate and verify filtering behavior
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs |
Relocates pagination state hash assignment to occur after successful data load instead of before, fixing double-refresh issue |
src/Components/test/testassets/BasicTestApp/QuickGridTest/QuickGridFilterComponent.razor |
New test component simulating filter application with call count tracking to validate the fix |
src/Components/test/E2ETest/Tests/QuickGridTest.cs |
Adds two new test cases verifying single ItemsProvider call for both pagination reset and explicit refresh scenarios |
src/Components/test/testassets/BasicTestApp/Index.razor |
Registers the new test component in the test app navigation menu |
src/Components/test/testassets/BasicTestApp/QuickGridTest/QuickGridFilterComponent.razor
Outdated
Show resolved
Hide resolved
src/Components/test/testassets/BasicTestApp/QuickGridTest/QuickGridFilterComponent.razor
Outdated
Show resolved
Hide resolved
src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs
Outdated
Show resolved
Hide resolved
…a/aspnetcore into 62605-hash-quickgrid
Fix multiple requests for ItemsProvider when changing the TotalItemCount
Description
This pull request improves the QuickGrid component by fixing how pagination state is tracked to prevent unnecessary data refreshes, and adds new end-to-end tests and a test component to verify correct ItemsProvider call behavior when filtering. The main focus is on ensuring that applying filters via pagination reset or explicit data refresh does not trigger extra data loads.
Changes:
_lastRefreshedPaginationStateHashinQuickGrid.razor.csto after the data load completes, ensuring the hash accurately reflects the refreshed state and preventing unnecessary refreshes.QuickGridTest.csto verify that filtering with either pagination reset or explicit refresh only results in a single additional ItemsProvider call, preventing redundant refreshes.QuickGridFilterComponent.razor, to support these tests by simulating filtering and tracking ItemsProvider calls.Fixes #62605