-
Notifications
You must be signed in to change notification settings - Fork 461
[DataGrid] Improve data refresh logic #2512
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
Merged
vnbaaij
merged 10 commits into
microsoft:dev
from
StevenTCramer:Cramer/2024-08-11/PaginationStateHash
Aug 20, 2024
Merged
[DataGrid] Improve data refresh logic #2512
vnbaaij
merged 10 commits into
microsoft:dev
from
StevenTCramer:Cramer/2024-08-11/PaginationStateHash
Aug 20, 2024
Conversation
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
This commit enhances the OnParametersSetAsync method in FluentDataGrid to better handle state changes: - Updated mustRefreshData calculation to consider pagination state changes - Moved _lastRefreshedPaginationStateHash update earlier in RefreshDataCoreAsync These changes ensure that: 1. The grid correctly detects when a refresh is needed due to pagination changes 2. The pagination state hash is captured at the start of the refresh process This improvement helps maintain data consistency, especially in scenarios with rapid state changes or when other events trigger state updates.
dvoituron
approved these changes
Aug 12, 2024
- Replace object casting and reference comparison with direct Equals method calls - Separately compare Items and ItemsProvider with their last assigned values - Eliminate false positive change detections caused by boxing - Improve performance by reducing unnecessary data refreshes
…b.com/StevenTCramer/fluentui-blazor into Cramer/2024-08-11/PaginationStateHash
Contributor
Author
|
Add fix for #2512 |
Contributor
Author
|
@dvoituron I updated PR you may want to review again. |
… of the comparison. As this is an output not an input.
vnbaaij
approved these changes
Aug 20, 2024
dannyldj
pushed a commit
to dannyldj/fluentui-blazor
that referenced
this pull request
Sep 26, 2024
* Improve data refresh logic in FluentDataGrid This commit enhances the OnParametersSetAsync method in FluentDataGrid to better handle state changes: - Updated mustRefreshData calculation to consider pagination state changes - Moved _lastRefreshedPaginationStateHash update earlier in RefreshDataCoreAsync These changes ensure that: 1. The grid correctly detects when a refresh is needed due to pagination changes 2. The pagination state hash is captured at the start of the refresh process This improvement helps maintain data consistency, especially in scenarios with rapid state changes or when other events trigger state updates. * Fix Grid data source change detection to avoid boxing - Replace object casting and reference comparison with direct Equals method calls - Separately compare Items and ItemsProvider with their last assigned values - Eliminate false positive change detections caused by boxing - Improve performance by reducing unnecessary data refreshes * Don't use GetHashCode for comparison. TotalCount should NOT be a part of the comparison. As this is an output not an input. * use _lastRefreshedPaginationState instead of _lastRefreshedPaginationStateHash * Remove blank line --------- Co-authored-by: Denis Voituron <[email protected]> Co-authored-by: Vincent Baaij <[email protected]>
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
This PR improves the data refresh logic in the FluentDataGrid component to better handle state changes, particularly those related to pagination. It addresses potential inconsistencies that could occur during rapid state changes or when other events trigger state updates.
This change is a fix that enhances the reliability and consistency of the FluentDataGrid component.
🎫 Issues
👩💻 Reviewer Notes
Reviewers should focus on:
OnParametersSetAsyncmethod, particularly themustRefreshDatacalculation.RefreshDataCoreAsyncmethod, noting the new position of the_lastRefreshedPaginationStateHashupdate.📑 Test Plan
✅ Checklist
General
Component-specific