-
Notifications
You must be signed in to change notification settings - Fork 32
BUGFIX-133: When host filter is enabled should sort matching items by their rank #134
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: develop
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #134 +/- ##
===========================================
+ Coverage 87.78% 87.81% +0.02%
===========================================
Files 40 41 +1
Lines 3454 3487 +33
===========================================
+ Hits 3032 3062 +30
- Misses 344 346 +2
- Partials 78 79 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Bug: Selection index mismatch when filtering and updating hosts
The setItemAndReorder() function calculates selection index by sorting items with hostComparator, but after removing UnsortedFilter, filtered items are displayed in match rank order instead. When m.Select(newVisibleItemsIndex) is called, it operates on the actual visible list (now sorted by match rank), causing the wrong item to be selected. This happens when editing a host while filtering is enabled and the host's position changes. Unlike onHostCreated() which calls ResetFilter() first, onHostUpdated() doesn't reset the filter, so the mismatch occurs.
internal/ui/component/hostlist/hostlist.go#L435-L441
goto/internal/ui/component/hostlist/hostlist.go
Lines 435 to 441 in 459a426
| slices.SortFunc(visibleItems, hostComparator) | |
| _, newVisibleItemsIndex, _ := lo.FindIndexOf(visibleItems, func(item list.Item) bool { | |
| return updatedHost.ID == item.(ListItemHost).ID //nolint:errcheck // item always contains ListItemHost | |
| }) | |
| m.Select(newVisibleItemsIndex) |
…items by their rank" This reverts commit 459a426.
No description provided.