Show peers immediately on discovery, before DataChannel opens

Emit peer_connected + peer_status(connecting) as soon as a PeerConn is
created, so peers appear in the sidebar even if ICE is still negotiating
or ultimately fails. The alias updates in-place once the DataChannel hello
arrives with the real nick.

Fixes: mobile/CGNAT peers being completely invisible when STUN hole
punching fails — they now show with a connecting/failed dot instead of
not appearing at all.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Fredrik Johansson
2026-06-25 20:54:47 +02:00
parent fb14ca82af
commit c4032417ae
2 changed files with 15 additions and 1 deletions

View File

@@ -235,7 +235,7 @@ export const useWaste = create<WasteState>((set, get) => ({
if (msg.peer) {
set(s => ({
connectedPeers: s.connectedPeers.some(p => p.id === msg.peer!.id)
? s.connectedPeers
? s.connectedPeers.map(p => p.id === msg.peer!.id ? { ...p, ...msg.peer } : p)
: [...s.connectedPeers, msg.peer!],
}))
}