Browse Source

feat(ServerAnalytic): add websocket cleanup on component unmount

Co-Authored-By: woncode <20252778+woncode@users.noreply.github.com>
Jacky 1 month ago
parent
commit
118dff1b82
1 changed files with 4 additions and 0 deletions
  1. 4 0
      app/src/views/dashboard/ServerAnalytic.vue

+ 4 - 0
app/src/views/dashboard/ServerAnalytic.vue

@@ -90,6 +90,10 @@ onMounted(() => {
   })
 })
 
+onUnmounted(() => {
+  websocket?.close()
+})
+
 function handle_uptime(t: number) {
   // uptime
   let _uptime = Math.floor(t)