-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Fix two loads in QuickGrid with Virtualize #63616
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
base: main
Are you sure you want to change the base?
Fix two loads in QuickGrid with Virtualize #63616
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 PR optimizes the QuickGrid component's data loading behavior when virtualization is enabled, preventing redundant data loads on initial render. The optimization introduces a flag to track the first refresh and allows the Virtualize component to handle the initial data loading itself.
Key changes:
- Added first-load tracking to prevent duplicate data loading
- Updated refresh logic to conditionally skip initial load for virtualized grids
- Improved performance by eliminating redundant initial data fetching
src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
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.
Can we have a unit test for this?
@@ -155,6 +155,8 @@ public partial class QuickGrid<TGridItem> : IAsyncDisposable | |||
// If the QuickGrid is disposed while the JS module is being loaded, we need to avoid calling JS methods | |||
private bool _wasDisposed; | |||
|
|||
private bool _firstRefreshDataAsync = true; |
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.
"Added a _firstRefreshDataAsync flag to the QuickGrid class to track whether the initial data load has occurred."
Can we simplify it to _shouldSkipDataLoad
? Or _shouldSkipDataRefresh
.
private bool _firstRefreshDataAsync = true; | |
private bool _shouldSkipDataLoad = true; |
src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs
Outdated
Show resolved
Hide resolved
f95786c
to
bad1df2
Compare
Fix two loads in QuickGrid with Virtualize
Description
This pull request introduces an optimization to the data loading logic for the
QuickGrid
component, specifically when using virtualization. The main goal is to prevent redundant data loading on the initial render, improving performance and user experience.Virtualization data loading optimization:
_firstRefreshDataAsync
flag to theQuickGrid
class to track whether the initial data load has occurred.RefreshDataCoreAsync
method to skip the data loading logic on the first render if virtualization is enabled, allowing theVirtualize
component to handle the initial data load itself.Fixes #55979