From b5b4fde13d177e2e40467dfbf6f4d3e7233568b9 Mon Sep 17 00:00:00 2001 From: Taksh Date: Sun, 2 Aug 2026 11:40:26 +0530 Subject: [PATCH] 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. --- bitchat/Views/MeshPeerList.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bitchat/Views/MeshPeerList.swift b/bitchat/Views/MeshPeerList.swift index 6dc42f09..e55116bd 100644 --- a/bitchat/Views/MeshPeerList.swift +++ b/bitchat/Views/MeshPeerList.swift @@ -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..