From 8e9a0b1e3ee7c98f14b494aab32f083e7f4bf7ce 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 c2c3fd9112..4943432cff 100644 --- a/packages/frontend/src/ui/_common_/stream-indicator.vue +++ b/packages/frontend/src/ui/_common_/stream-indicator.vue @@ -33,12 +33,17 @@ const zIndex = os.claimZIndex('high'); let hasRequireRefresh = $ref(false); 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; } @@ -50,6 +55,7 @@ function reload() { location.reload(); } +useStream().on('_connected_', resetDisconnected); useStream().on('_disconnected_', onDisconnected); onMounted(() => { @@ -59,6 +65,8 @@ onMounted(() => { }); onUnmounted(() => { + window.clearTimeout(timeoutId); + useStream().off('_connected_', resetDisconnected); useStream().off('_disconnected_', onDisconnected); });