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); + } + } });