-
-
Notifications
You must be signed in to change notification settings - Fork 381
fix(Table): use Equlas instead of Contains #7648
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -105,7 +105,8 @@ protected CheckboxState HeaderCheckState() | |||||||||||||||||||||||||||||
| /// <param name="val"></param> | ||||||||||||||||||||||||||||||
| protected virtual async Task OnHeaderCheck(CheckboxState state, TItem val) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| SelectedRows.RemoveAll(Rows.Intersect(SelectedRows).Contains); | ||||||||||||||||||||||||||||||
| var items = Rows.Intersect(SelectedRows); | ||||||||||||||||||||||||||||||
| SelectedRows.RemoveAll(i => items.Any(item => Equals(item, i))); | ||||||||||||||||||||||||||||||
|
ArgoZhang marked this conversation as resolved.
Comment on lines
+108
to
+109
|
||||||||||||||||||||||||||||||
| var items = Rows.Intersect(SelectedRows); | |
| SelectedRows.RemoveAll(i => items.Any(item => Equals(item, i))); | |
| var items = new HashSet<TItem>(Rows.Intersect(SelectedRows)); | |
| SelectedRows.RemoveAll(i => items.Contains(i)); |
Copilot
AI
Feb 10, 2026
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.
Rows.Intersect(SelectedRows) uses EqualityComparer<TItem>.Default and will ignore the table's model equality logic (ModelEqualityComparer / CustomKeyAttribute / DynamicContext.EqualityComparer). This means some selected rows may not be removed correctly, so the change may not actually fix the reported selection mismatch.
Consider building the removal set using the table's model comparer (e.g., new ModelHashSetComparer<TItem>(this)) and then removing via HashSet.Contains, or otherwise ensure the intersection/removal uses Table.Equals(TItem,TItem) semantics throughout.
| var items = Rows.Intersect(SelectedRows); | |
| SelectedRows.RemoveAll(i => items.Any(item => Equals(item, i))); | |
| // Build removal set using the table's model equality comparer to ensure | |
| // that intersection logic respects custom model equality semantics. | |
| var removalSet = new HashSet<TItem>(new ModelHashSetComparer<TItem>(this)); | |
| foreach (var row in Rows) | |
| { | |
| removalSet.Add(row); | |
| } | |
| SelectedRows.RemoveAll(i => removalSet.Contains(i)); |
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.
The English string uses a full-width colon character (
:), which is inconsistent with the rest of en-US resources (e.g., "Keep State:") and may look incorrect in UI. Consider changing it to an ASCII colon and spacing (e.g., "Count: {0}").