[DataGridPro] Remove rows deleted server-side on nested lazy loading revalidation - #23320
Draft
JCQuintas wants to merge 2 commits into
Draft
[DataGridPro] Remove rows deleted server-side on nested lazy loading revalidation#23320JCQuintas wants to merge 2 commits into
JCQuintas wants to merge 2 commits into
Conversation
Repros issue mui#23305: nested (tree data) lazy loading does not prune rows the server drops on revalidation. Flat control test passes.
…revalidation Nested (tree data / row grouping) lazy loading only replaced rows positionally and padded skeletons up to the row count, so a shrinking result set left stale rows and skeleton rows that never resolved. Trim a parent's children to the row count reported by the response, in all three update paths: the positional replacement, the in-place (same ids) update, and empty responses. Root level rows are also trimmed when the page row count shrinks, and a group's serverChildrenCount is kept in sync with the server. Fixes mui#23305
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
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.
Fixes #23305
Nested (tree data / row grouping) lazy loading never reconciled rows that the server dropped between two fetches: rows were replaced positionally and skeletons were only ever padded up to the row count, so a shrinking result set left stale rows behind, or skeleton rows that never resolved.
Changes
useGridDataSourceNestedLazyLoader:trimChildrenToRowCounthelper: drops the children past the row count reported by the response, together with their subtrees, and cleans upchildrenFromPath. Ids re-added by the current pass keep their tree entry.replaceNestedRowstrims after the positional replacement, and keeps a group'sserverChildrenCountin sync with the server.pruneRowsToRowCountcovers the pathsreplaceNestedRowscannot: empty responses, and the in-place update path (same ids at the same positions), which previously returned early and left the extra children untouched.addRootSkeletonRowsnow also trims root rows when the page row count shrinks.pageRowCount > 0keeps an unknown or not-yet-known count from wiping loaded rows; a genuine drop to 0 goes throughpruneRowsToRowCount.Tests
Four tests in
dataSourceLazyLoader.DataGridPro.test.tsx, all failing before this change: