mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-10-25 07:41:41 +00:00
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:
parent
87ca50112d
commit
b5b4fde13d
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user