From c8593a9668fed6b444ab380e8d0b0c7541660e30 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 1 Sep 2026 18:36:57 +0300 Subject: [PATCH] P3 --- src/stores/streaming.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/stores/streaming.js b/src/stores/streaming.js index 7fa00bdbc..a1cf0b885 100644 --- a/src/stores/streaming.js +++ b/src/stores/streaming.js @@ -108,7 +108,14 @@ export const useStreamingStore = defineStore('streaming', { } }, initSocket(initial) { - if (this.socket) throw new Error('Socket already exists!') + if (this.socket) { + console.error("Socket already exists! This shouldn't happen! Force-closing the socket just in case") + try { + this.socket.close() + } catch (e) { + console.error("Error closing existing socket that shouldn't be there. Welp. Moving on.", e) + } + } this.state = initial ? WSConnectionStatus.STARTING_INITIAL @@ -130,7 +137,8 @@ export const useStreamingStore = defineStore('streaming', { this.socket.addEventListener('error', this.onError) }, stopSocket() { - this.socket.close() + if (this.socket == null) console.error("Socket is already stopped! This shouldn't happen!") + this.socket?.close() this.socket = null this.state = WSConnectionStatus.CLOSED this.retrying = false