Story 15: Implement New Session cancellation
- Call cancel_chat before clearing session state - Prevents tools from executing silently in background - Prevents streaming from leaking into new session - Uses same cancellation infrastructure as Story 13 - Clean session start with no side effects Closes Story 15
This commit is contained in:
@@ -197,11 +197,17 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
|
// Cancel any in-flight backend requests first
|
||||||
|
try {
|
||||||
|
await invoke("cancel_chat");
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Failed to cancel chat:", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then clear frontend state
|
||||||
setMessages([]);
|
setMessages([]);
|
||||||
setStreamingContent("");
|
setStreamingContent("");
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
// TODO: Add backend call to cancel in-flight requests and clear context
|
|
||||||
// invoke("cancel_chat").catch(console.error);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user