Skip to content

Conversation

@grafviktor
Copy link
Owner

@grafviktor grafviktor commented Dec 18, 2025

No description provided.

@grafviktor grafviktor self-assigned this Dec 18, 2025
@grafviktor grafviktor linked an issue Dec 18, 2025 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.81%. Comparing base (a38fcbc) to head (f4740c2).

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     
Flag Coverage Δ
go-1.22.x 87.81% <100.00%> (+0.11%) ⬆️
go-1.25.x 87.81% <100.00%> (+0.02%) ⬆️
macOS 87.41% <100.00%> (+0.12%) ⬆️
ubuntu 87.41% <100.00%> (+0.12%) ⬆️
unit 87.81% <100.00%> (+0.02%) ⬆️
windows 85.59% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@cursor cursor bot left a 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

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)

Fix in Cursor Fix in Web


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Should sort filter results by rank

2 participants