Add debug logging to clearSession to diagnose Cancel button bug

This commit is contained in:
Dave
2025-12-27 17:30:03 +00:00
parent bd8d838457
commit 418fa86f7d

View File

@@ -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");
}
};