From 1c3752ed0fbb89ea54d46bfeb845eefdf9468511 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 15 Jun 2026 13:32:13 +0200 Subject: [PATCH] refac --- cptr/frontend/src/lib/stores/chat.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/cptr/frontend/src/lib/stores/chat.ts b/cptr/frontend/src/lib/stores/chat.ts index 2364216..5230a2b 100644 --- a/cptr/frontend/src/lib/stores/chat.ts +++ b/cptr/frontend/src/lib/stores/chat.ts @@ -5,7 +5,7 @@ import { writable, get } from 'svelte/store'; import { toast } from 'svelte-sonner'; import { fetchJSON } from '$lib/apis'; import { socketStore } from '$lib/stores/socket.svelte'; -import { activeTab, openChatTab } from '$lib/stores'; +import { activeTab } from '$lib/stores'; export const chatEnabled = writable(false); @@ -103,15 +103,9 @@ export function bindGlobalChatListener() { title, content: body, onClick: async () => { - // Navigate to workspace page first if not already there - const wsPath = data.workspace; - if (wsPath && window.location.pathname !== '/') { - const { goto } = await import('$app/navigation'); - await goto(`/?workspace=${encodeURIComponent(wsPath)}`); - setTimeout(() => openChatTab(chatId), 300); - } else { - openChatTab(chatId); - } + const { goto } = await import('$app/navigation'); + const wsParam = data.workspace ? `workspace=${encodeURIComponent(data.workspace)}&` : ''; + await goto(`/?${wsParam}chatId=${encodeURIComponent(chatId)}`); toast.dismiss(toastId); }, onclose: () => {