From efc7e4c7fbeb2b311c17bdcba5540a4f96b20330 Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Sat, 4 Jul 2026 23:40:00 -0700 Subject: [PATCH] Network Type Transition Optimization Nucleic-Session: 40F8C53A-F001-423A-8607-EAE181DBE14B Co-authored-by: Nucleic --- NucleicRemote/NucleicRemote/NucleicRemoteApp.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/NucleicRemote/NucleicRemote/NucleicRemoteApp.swift b/NucleicRemote/NucleicRemote/NucleicRemoteApp.swift index 267c7c1..c8132f1 100644 --- a/NucleicRemote/NucleicRemote/NucleicRemoteApp.swift +++ b/NucleicRemote/NucleicRemote/NucleicRemoteApp.swift @@ -28,7 +28,12 @@ struct NucleicRemoteApp: App { // activity flag current so it only notifies for background transitions. .onChange(of: scenePhase) { _, phase in store.setScenePhaseActive(phase == .active) - if phase == .active { Task { await HeartbeatReporter.reportIfDue() } } + if phase == .active { + // Re-plan transports immediately on foreground — the network may have + // changed while suspended, so don't wait for a dead socket to notice. + store.onForeground() + Task { await HeartbeatReporter.reportIfDue() } + } } } }