From 3ef0e9f2c55658b9a66c93a9132b95b5e50d4f54 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Tue, 10 Mar 2026 18:02:57 -0400 Subject: [PATCH] Delete empty untitled chat on navigate-away from ChatView Previously the empty-conversation cleanup only fired when switching between chats (convId watcher). Navigating to /notes, /tasks, etc. left orphaned untitled empty conversations. onUnmounted now runs the same check, deleting the current conversation if message_count === 0. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/views/ChatView.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/views/ChatView.vue b/frontend/src/views/ChatView.vue index 6ad0fad..011a181 100644 --- a/frontend/src/views/ChatView.vue +++ b/frontend/src/views/ChatView.vue @@ -476,6 +476,13 @@ function onGlobalKeydown(e: KeyboardEvent) { onUnmounted(() => { document.removeEventListener("keydown", onGlobalKeydown); + // Clean up empty conversation when navigating away from the chat view entirely + if (prevConvId) { + const conv = store.conversations.find((c) => c.id === prevConvId); + if (conv && conv.message_count === 0) { + store.deleteConversation(prevConvId); + } + } });