fix(ui): сохранять точный выбор пира при экспорте WireGuard

This commit is contained in:
Denozordec committed 2026-09-29 08:40:36 +07:00
1 parent 4aa4726c6b
commit 425a77a1ca
8 files changed
+68 -10

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
/** An explicit missing selection must never fall back to another peer. */
export function selectWgExportPeer<T extends { id?: string; rosId?: string }>(peers: readonly T[], peerId?: string | null): T | undefined {
return peerId == null ? peers[0] : peers.find(peer => peer.id === peerId || peer.rosId === peerId)
}