From 722f10b7fa52a9c9e1c22c30b8cb27d7e914580a Mon Sep 17 00:00:00 2001 From: riku6460 <17585784+riku6460@users.noreply.github.com> Date: Fri, 6 Oct 2023 21:57:37 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B5=E3=83=BC=E3=83=90=E3=83=BC=E3=81=8B?= =?UTF-8?q?=E3=82=89=E5=88=87=E6=96=AD=E3=81=95=E3=82=8C=E3=81=9F=E5=BE=8C?= =?UTF-8?q?=20stream=20indicator=20=E3=82=92=E3=81=99=E3=81=90=E3=81=AB?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B=20(MisskeyIO#172)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit すぐに再接続されたら表示しないように --- packages/frontend/src/ui/_common_/stream-indicator.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/ui/_common_/stream-indicator.vue b/packages/frontend/src/ui/_common_/stream-indicator.vue index b09221f5d2..3752a6df75 100644 --- a/packages/frontend/src/ui/_common_/stream-indicator.vue +++ b/packages/frontend/src/ui/_common_/stream-indicator.vue @@ -24,12 +24,17 @@ import { defaultStore } from '@/store.js'; const zIndex = os.claimZIndex('high'); let hasDisconnected = $ref(false); +let timeoutId = $ref(); function onDisconnected() { - hasDisconnected = true; + window.clearTimeout(timeoutId); + timeoutId = window.setTimeout(() => { + hasDisconnected = true; + }, 1000 * 10); } function resetDisconnected() { + window.clearTimeout(timeoutId); hasDisconnected = false; } @@ -37,9 +42,12 @@ function reload() { location.reload(); } +useStream().on('_connected_', resetDisconnected); useStream().on('_disconnected_', onDisconnected); onUnmounted(() => { + window.clearTimeout(timeoutId); + useStream().off('_connected_', resetDisconnected); useStream().off('_disconnected_', onDisconnected); });