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