From 6170a2ccd01a361936e75d31574c0ffb76ecff19 Mon Sep 17 00:00:00 2001 From: Gagan Suie Date: Tue, 14 May 2024 20:05:34 -0500 Subject: [PATCH] Fix: moved websocket listener above emits --- src/routes/channel/[channelId]/+page.svelte | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/routes/channel/[channelId]/+page.svelte b/src/routes/channel/[channelId]/+page.svelte index b947baf2..81081a7f 100644 --- a/src/routes/channel/[channelId]/+page.svelte +++ b/src/routes/channel/[channelId]/+page.svelte @@ -50,16 +50,6 @@ $: isLive = channel?.videoItems?.some((input: any) => input?.rtmps?.isConnected) ?? false onMount(async () => { - clearInterval(platformPollingInterval) - platformPollingInterval = null - await loadChannel() - await handleWebsocket() - await loadMoreChannels() - $is_chat_drawer_destroy = false - setTimeout(() => { - $is_chat_drawer_open = true - }, 600) - channel_message.subscribe(async (value: any) => { if (!value || !channel || (channel && parseInt($page.params.channelId) !== channel._id)) return @@ -134,6 +124,15 @@ break } }) + clearInterval(platformPollingInterval) + platformPollingInterval = null + await loadChannel() + await handleWebsocket() + await loadMoreChannels() + $is_chat_drawer_destroy = false + setTimeout(() => { + $is_chat_drawer_open = true + }, 600) }) onDestroy(async () => {