From 4cc0c25916e729252e000067f2a555f16d3e227c Mon Sep 17 00:00:00 2001 From: ingalls Date: Tue, 10 Dec 2024 21:03:28 -0700 Subject: [PATCH] Update CHANGELOG --- CHANGELOG.md | 4 ++++ api/web/src/components/CloudTAK/Map.vue | 2 +- api/web/src/stores/connection.ts | 10 +++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64d5ea841..970835151 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ ### Pending Release +### v5.19.1 - 2024-12-10 + +- :rocket: `UI` Ensure switching to Admin Component doesn't throw an error + ### v5.19.0 - 2024-12-10 - :rocket: `UI` Update Main Map to TS diff --git a/api/web/src/components/CloudTAK/Map.vue b/api/web/src/components/CloudTAK/Map.vue index 37cc02cd8..f9370fc0f 100644 --- a/api/web/src/components/CloudTAK/Map.vue +++ b/api/web/src/components/CloudTAK/Map.vue @@ -730,8 +730,8 @@ onMounted(async () => { onBeforeUnmount(() => { if (timer.value) window.clearInterval(timer.value); if (timerSelf.value) window.clearInterval(timerSelf.value); - if (connectionStore.ws) connectionStore.ws.close(); + connectionStore.destroy(); cotStore.$reset(); mapStore.destroy(); }); diff --git a/api/web/src/stores/connection.ts b/api/web/src/stores/connection.ts index e9dc21a5b..14838407e 100644 --- a/api/web/src/stores/connection.ts +++ b/api/web/src/stores/connection.ts @@ -12,16 +12,24 @@ const cotStore = useCOTStore(); export const useConnectionStore = defineStore('connection', { state: (): { + destroyed: boolean open: boolean ws?: WebSocket } => { return { + destroyed: false, open: false, ws: undefined } }, actions: { + destroy: function() { + this.destroyed = true; + if (this.ws) this.ws.close(); + }, connectSocket: function(connection: string) { + this.destroyed = false; + const url = stdurl('/api'); url.searchParams.append('format', 'geojson'); url.searchParams.append('connection', connection); @@ -43,7 +51,7 @@ export const useConnectionStore = defineStore('connection', { this.ws.addEventListener('close', () => { // Otherwise the user is probably logged out - if (localStorage.token) this.connectSocket(connection); + if (localStorage.token && !this.destroyed) this.connectSocket(connection); this.open = false; });