diff --git a/packages/client/src/stream.ts b/packages/client/src/stream.ts index 0bc6198da1..70e860250b 100644 --- a/packages/client/src/stream.ts +++ b/packages/client/src/stream.ts @@ -3,26 +3,18 @@ import { markRaw } from "vue"; import { $i } from "@/account"; import { url } from "@/config"; -let stream: Misskey.Stream | null = null; +export const stream = markRaw( + new Misskey.Stream( + url, + $i + ? { + token: $i.token, + } + : null, + ), +); -export function useStream(): Misskey.Stream { - if (stream) return stream; - - stream = markRaw( - new Misskey.Stream( - url, - $i - ? { - token: $i.token, - } - : null - ) - ); - - window.setTimeout(heartbeat, 1000 * 60); - - return stream; -} +window.setTimeout(heartbeat, 1000 * 60); function heartbeat(): void { if (stream != null && document.visibilityState === "visible") {