diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c57894..43f1d21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.4.8] - 2026-06-15 + +### Fixed + +- 💬 **Clicking chats now opens them instantly.** Tapping a chat in the sidebar, clicking "View Chat" on an automation run, or following a notification toast now takes you straight to the conversation. Previously these actions could sometimes get stuck or fail to switch to the right chat. + ## [0.4.7] - 2026-06-15 ### Fixed diff --git a/cptr/frontend/src/lib/components/Sidebar.svelte b/cptr/frontend/src/lib/components/Sidebar.svelte index f20f902..fa1557e 100644 --- a/cptr/frontend/src/lib/components/Sidebar.svelte +++ b/cptr/frontend/src/lib/components/Sidebar.svelte @@ -11,10 +11,7 @@ appVersion, showChangelog, showSearch, - openChatTab, - setActiveTab } from '$lib/stores'; - import { get } from 'svelte/store'; import Sortable from 'sortablejs'; import Icon from './Icon.svelte'; import KeyPill from './KeyPill.svelte'; @@ -106,23 +103,7 @@ } function handleShowMoreChats(wsPath: string) { - goto(`/?workspace=${encodeURIComponent(wsPath)}`); - - const ws = get(currentWorkspace); - if (ws) { - for (const group of ws.groups) { - const existing = group.tabs.find( - (t) => t.type === 'chat' && (t.path?.startsWith('new-') || t.path?.startsWith('pending-')) - ); - if (existing) { - setActiveTab(existing.id, group.id); - if (typeof window !== 'undefined' && window.innerWidth < 768) sidebarOpen.set(false); - return; - } - } - } - - openChatTab(); + goto(`/?workspace=${encodeURIComponent(wsPath)}&chatId`); if (typeof window !== 'undefined' && window.innerWidth < 768) { sidebarOpen.set(false); } diff --git a/cptr/frontend/src/lib/components/automations/AutomationsPanel.svelte b/cptr/frontend/src/lib/components/automations/AutomationsPanel.svelte index f8391fa..56a1402 100644 --- a/cptr/frontend/src/lib/components/automations/AutomationsPanel.svelte +++ b/cptr/frontend/src/lib/components/automations/AutomationsPanel.svelte @@ -8,7 +8,7 @@ import ToggleSwitch from '../common/ToggleSwitch.svelte'; import Spinner from '../common/Spinner.svelte'; import AutomationModal from './AutomationModal.svelte'; - import { openChatTab, sidebarOpen } from '$lib/stores'; + import { sidebarOpen } from '$lib/stores'; import { getAutomations, toggleAutomation, @@ -335,10 +335,8 @@ class="text-[11px] text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors duration-75" onclick={() => { const ws = detail?.workspace; - if (ws) { - goto(`/?workspace=${encodeURIComponent(ws)}`); - } - setTimeout(() => openChatTab(run.chat_id!), 300); + const wsParam = ws ? `workspace=${encodeURIComponent(ws)}&` : ''; + goto(`/?${wsParam}chatId=${encodeURIComponent(run.chat_id!)}`); }} > {$t('automations.viewChat')} 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: () => { diff --git a/pyproject.toml b/pyproject.toml index 1c4ead7..28b756d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cptr" -version = "0.4.7" +version = "0.4.8" description = "Your computer, from anywhere. Code, manage, and control your machine from the web." license = {file = "LICENSE"} readme = "README.md"