fix: preserve mesh people sticky order while search has no matches

Keep orderedIDs synced from the unfiltered roster in the mesh no-matches
branch so clearing search does not reshuffle rows.
This commit is contained in:
Taksh 2026-08-02 11:40:26 +05:30
parent 87ca50112d
commit b5b4fde13d

View File

@ -62,6 +62,15 @@ struct MeshPeerList: View {
.foregroundColor(palette.secondary)
.padding(.horizontal)
.padding(.vertical, 4)
.onAppear {
orderedIDs = currentIDs
}
.onChange(of: currentIDs) { ids in
var newOrder = orderedIDs
newOrder.removeAll { !ids.contains($0) }
for id in ids where !newOrder.contains(id) { newOrder.append(id) }
if newOrder != orderedIDs { orderedIDs = newOrder }
}
} else {
VStack(alignment: .leading, spacing: 0) {
ForEach(0..<peers.count, id: \.self) { idx in