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..