diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 05982a82d..a82009c4d 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -92,7 +92,7 @@ }; const chatEventHandler = async (event) => { - if (event.chat_id !== $chatId) { + if (event.chat_id !== $chatId || document.visibilityState !== 'visible') { await tick(); const type = event?.data?.type ?? null; const data = event?.data?.data ?? null; @@ -126,7 +126,7 @@ // check url path const channel = $page.url.pathname.includes(`/channels/${event.channel_id}`); - if (!channel && event?.user?.id !== $user?.id) { + if ((!channel || document.visibilityState !== 'visible') && event?.user?.id !== $user?.id) { await tick(); const type = event?.data?.type ?? null; const data = event?.data?.data ?? null;