From 418fa86f7dc279300c080f65cd11f6a3b7949933 Mon Sep 17 00:00:00 2001 From: Dave Date: Sat, 27 Dec 2025 17:30:03 +0000 Subject: [PATCH] Add debug logging to clearSession to diagnose Cancel button bug --- src/components/Chat.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/Chat.tsx b/src/components/Chat.tsx index eb01566..c0c670a 100644 --- a/src/components/Chat.tsx +++ b/src/components/Chat.tsx @@ -164,15 +164,24 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) { }; const clearSession = () => { + // Store current state in case we need to debug + console.log("clearSession called, messages count:", messages.length); + const confirmed = window.confirm( "Are you sure? This will clear all messages and reset the conversation context.", ); - if (confirmed) { + + console.log("User confirmed:", confirmed); + + if (confirmed === true) { + console.log("Clearing session..."); setMessages([]); setStreamingContent(""); setLoading(false); // TODO: Add backend call to clear context when implemented // invoke("clear_session").catch(console.error); + } else { + console.log("User cancelled, keeping messages"); } };