From c7bcd33fb8a489f89c241e2ac6cda66ba492a709 Mon Sep 17 00:00:00 2001 From: mobile-bungalow Date: Sun, 6 Apr 2025 12:50:20 -0700 Subject: [PATCH 1/2] Do not throw error on idempotent calls --- .../LiveViewNative/Coordinators/LiveSessionCoordinator.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/LiveViewNative/Coordinators/LiveSessionCoordinator.swift b/Sources/LiveViewNative/Coordinators/LiveSessionCoordinator.swift index d742c38d2..1cf493ea7 100644 --- a/Sources/LiveViewNative/Coordinators/LiveSessionCoordinator.swift +++ b/Sources/LiveViewNative/Coordinators/LiveSessionCoordinator.swift @@ -112,7 +112,7 @@ public class LiveSessionCoordinator: ObservableObject { $navigationPath.scan(([LiveNavigationEntry](), [LiveNavigationEntry]()), { ($0.1, $1) }).sink { [weak self] prev, next in guard let self else { return } Task { - try await prev.last?.coordinator.disconnect() + try? await prev.last?.coordinator.disconnect() if prev.count > next.count { let targetEntry = self.liveSocket!.getEntries()[next.count - 1] next.last?.coordinator.join( @@ -336,7 +336,7 @@ public class LiveSessionCoordinator: ObservableObject { private func disconnect(preserveNavigationPath: Bool = false) async { do { for entry in self.navigationPath { - try await entry.coordinator.disconnect() + try? await entry.coordinator.disconnect() if !preserveNavigationPath { entry.coordinator.document = nil } From c7810251bf3559ab32755296b4a52ecf088b6572 Mon Sep 17 00:00:00 2001 From: mobile-bungalow Date: Sun, 6 Apr 2025 14:28:32 -0700 Subject: [PATCH 2/2] shutdown as well --- .../LiveViewNative/Coordinators/LiveSessionCoordinator.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/LiveViewNative/Coordinators/LiveSessionCoordinator.swift b/Sources/LiveViewNative/Coordinators/LiveSessionCoordinator.swift index 1cf493ea7..191c7b6cb 100644 --- a/Sources/LiveViewNative/Coordinators/LiveSessionCoordinator.swift +++ b/Sources/LiveViewNative/Coordinators/LiveSessionCoordinator.swift @@ -213,7 +213,7 @@ public class LiveSessionCoordinator: ObservableObject { .merging(additionalHeaders ?? [:]) { $1 } if let socket { - try await socket.shutdown() + try? await socket.shutdown() } let adapter = ReconnectStrategyAdapter(self.configuration.reconnectBehavior) @@ -360,7 +360,7 @@ public class LiveSessionCoordinator: ObservableObject { self.liveReloadChannel = nil - try await self.socket?.shutdown() + try? await self.socket?.shutdown() self.socket = nil self.liveSocket = nil self.state = .disconnected