Ver Fonte

feat(ServerAnalytic): add websocket cleanup on component unmount

Co-Authored-By: woncode <20252778+woncode@users.noreply.github.com>
Jacky há 1 mês atrás
pai
commit
118dff1b82
1 ficheiros alterados com 4 adições e 0 exclusões
  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)