From b198c94efb9a0c123dc323942f34ce1aa3579290 Mon Sep 17 00:00:00 2001 From: G30 <50341825+silentoplayz@users.noreply.github.com> Date: Wed, 9 Sep 2026 16:24:10 -0400 Subject: [PATCH] fix: open the thread when a notification toast for a thread reply is clicked (#29856) --- src/lib/components/channel/Channel.svelte | 6 ++++++ src/routes/+layout.svelte | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/components/channel/Channel.svelte b/src/lib/components/channel/Channel.svelte index d552ba89b0..0dec5fb9d0 100644 --- a/src/lib/components/channel/Channel.svelte +++ b/src/lib/components/channel/Channel.svelte @@ -3,6 +3,7 @@ import { onDestroy, onMount, tick } from 'svelte'; import { goto } from '$app/navigation'; + import { page } from '$app/stores'; import { v4 as uuidv4 } from 'uuid'; import { @@ -48,6 +49,11 @@ initHandler(); } + $: if (channel && $page.url.searchParams.get('thread')) { + threadId = $page.url.searchParams.get('thread'); + window.history.replaceState(history.state, '', `/channels/${id}`); + } + const scrollToBottom = () => { if (messagesContainerElement) { messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 43b5a40929..e121267223 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -864,7 +864,9 @@ toast.custom(NotificationToast, { componentProps: { onClick: () => { - goto(`/channels/${event.channel_id}`); + goto( + `/channels/${event.channel_id}${data?.parent_id ? `?thread=${data.parent_id}` : ''}` + ); }, content: data?.content, title: `${title}`