handle some edge cases for socket lifecycle

This commit is contained in:
Henry Jameson 2026-09-01 11:50:47 +03:00
commit 64cc748a9c
2 changed files with 8 additions and 0 deletions

View file

@ -72,6 +72,9 @@ const GeneralTab = {
useLocalConfigStore().set({ path, value })
},
toggleStreaming(value) {
// Streaming is not available for the unauthenticated
if (!useOAuthStore().token) return
if (value) {
useStreamingStore().initSocket()
} else {

View file

@ -130,6 +130,9 @@ export const useStreamingStore = defineStore('streaming', {
stopSocket() {
this.socket.close()
this.state = WSConnectionStatus.CLOSED
this.retrying = false
this.retryMultiplier = 1
this.error = null
},
getSubArgs(stream) {
@ -229,6 +232,8 @@ export const useStreamingStore = defineStore('streaming', {
)
setTimeout(() => {
if (this.retrying) return // retry aborted (i.e. due to logout)
this.initSocket()
}, retryTimeout(this.retryMultiplier))