Skip to content

Commit 5bbdee0

Browse files
prevent leak when reconnecting from error view (#1569)
1 parent 9449023 commit 5bbdee0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/LiveViewNative/Coordinators/LiveSessionCoordinator.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ public class LiveSessionCoordinator<R: RootRegistry>: ObservableObject {
216216
try? await socket.shutdown()
217217
}
218218

219+
if let liveReloadChannel {
220+
try? await liveReloadChannel.shutdownParentSocket()
221+
}
222+
219223
let adapter = ReconnectStrategyAdapter(self.configuration.reconnectBehavior)
220224

221225
self.liveSocket = try await LiveSocket(
@@ -287,7 +291,7 @@ public class LiveSessionCoordinator<R: RootRegistry>: ObservableObject {
287291
func overrideLiveReloadChannel(channel: LiveChannel) async throws {
288292

289293
if let liveReloadChannel {
290-
try await liveReloadChannel.shutdownParentSocket()
294+
try? await liveReloadChannel.shutdownParentSocket()
291295
self.liveReloadChannel = nil
292296
}
293297

0 commit comments

Comments
 (0)