From 689b88b9421481e6dc84a1a9b5eaf2d695de84c4 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 10 Nov 2023 17:52:50 +0900 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20pull=20to=20refresh=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=81=9F=E3=81=B3=E3=81=AB=E3=82=B9=E3=83=88=E3=83=AA?= =?UTF-8?q?=E3=83=BC=E3=83=9F=E3=83=B3=E3=82=B0=E5=85=A8=E4=BD=93=E3=81=AE?= =?UTF-8?q?=E5=86=8D=E6=8E=A5=E7=B6=9A=E3=81=8C=E8=A1=8C=E3=82=8F=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/boot/main-boot.ts | 3 +-- .../frontend/src/components/MkTimeline.vue | 3 +-- packages/frontend/src/stream.ts | 20 ++----------------- .../src/ui/_common_/stream-indicator.vue | 3 +-- .../frontend/src/ui/deck/direct-column.vue | 2 -- .../frontend/src/ui/deck/mentions-column.vue | 2 -- 6 files changed, 5 insertions(+), 28 deletions(-) diff --git a/packages/frontend/src/boot/main-boot.ts b/packages/frontend/src/boot/main-boot.ts index 887740f4a..71236e4c5 100644 --- a/packages/frontend/src/boot/main-boot.ts +++ b/packages/frontend/src/boot/main-boot.ts @@ -8,7 +8,7 @@ import { common } from './common.js'; import { version, ui, lang, updateLocale } from '@/config.js'; import { i18n, updateI18n } from '@/i18n.js'; import { confirm, alert, post, popup, toast } from '@/os.js'; -import { useStream, isReloading } from '@/stream.js'; +import { useStream } from '@/stream.js'; import * as sound from '@/scripts/sound.js'; import { $i, refreshAccount, login, updateAccount, signout } from '@/account.js'; import { defaultStore, ColdDeviceStorage } from '@/store.js'; @@ -39,7 +39,6 @@ export async function mainBoot() { let reloadDialogShowing = false; stream.on('_disconnected_', async () => { - if (isReloading) return; if (defaultStore.state.serverDisconnectedBehavior === 'reload') { location.reload(); } else if (defaultStore.state.serverDisconnectedBehavior === 'dialog') { diff --git a/packages/frontend/src/components/MkTimeline.vue b/packages/frontend/src/components/MkTimeline.vue index 845c7a414..0f8fcaab6 100644 --- a/packages/frontend/src/components/MkTimeline.vue +++ b/packages/frontend/src/components/MkTimeline.vue @@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only import { computed, provide, onUnmounted } from 'vue'; import MkNotes from '@/components/MkNotes.vue'; import MkPullToRefresh from '@/components/MkPullToRefresh.vue'; -import { useStream, reloadStream } from '@/stream.js'; +import { useStream } from '@/stream.js'; import * as sound from '@/scripts/sound.js'; import { $i } from '@/account.js'; import { instance } from '@/instance.js'; @@ -201,7 +201,6 @@ function reloadTimeline() { tlNotesCount = 0; tlComponent.pagingComponent?.reload().then(() => { - reloadStream(); res(); }); }); diff --git a/packages/frontend/src/stream.ts b/packages/frontend/src/stream.ts index 1e2d31480..27fce4d4b 100644 --- a/packages/frontend/src/stream.ts +++ b/packages/frontend/src/stream.ts @@ -9,9 +9,6 @@ import { $i } from '@/account.js'; import { url } from '@/config.js'; let stream: Misskey.Stream | null = null; -let timeoutHeartBeat: number | null = null; - -export let isReloading: boolean = false; export function useStream(): Misskey.Stream { if (stream) return stream; @@ -20,20 +17,7 @@ export function useStream(): Misskey.Stream { token: $i.token, } : null)); - timeoutHeartBeat = window.setTimeout(heartbeat, 1000 * 60); - - return stream; -} - -export function reloadStream() { - if (!stream) return useStream(); - if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat); - isReloading = true; - - stream.close(); - stream.once('_connected_', () => isReloading = false); - stream.stream.reconnect(); - timeoutHeartBeat = window.setTimeout(heartbeat, 1000 * 60); + window.setTimeout(heartbeat, 1000 * 60); return stream; } @@ -42,5 +26,5 @@ function heartbeat(): void { if (stream != null && document.visibilityState === 'visible') { stream.heartbeat(); } - timeoutHeartBeat = window.setTimeout(heartbeat, 1000 * 60); + window.setTimeout(heartbeat, 1000 * 60); } diff --git a/packages/frontend/src/ui/_common_/stream-indicator.vue b/packages/frontend/src/ui/_common_/stream-indicator.vue index c3107b4e4..b09221f5d 100644 --- a/packages/frontend/src/ui/_common_/stream-indicator.vue +++ b/packages/frontend/src/ui/_common_/stream-indicator.vue @@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only