Skip to content

Commit 053c1c0

Browse files
committed
chat: reset messages when establishing a new server connection
1 parent 1e44c1a commit 053c1c0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

chat/src/components/ChatInterface.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ export default function ChatInterface() {
5050
if (eventSourceRef.current) {
5151
eventSourceRef.current.close();
5252
}
53-
53+
54+
// Reset messages when establishing a new connection
55+
setMessages([]);
56+
5457
const eventSource = new EventSource(`${AgentAPIUrl}/events`);
5558
eventSourceRef.current = eventSource;
5659

@@ -95,6 +98,7 @@ export default function ChatInterface() {
9598
eventSource.onopen = () => {
9699
// Connection is established, but we'll wait for status_change event
97100
// for the actual server status
101+
console.log("EventSource connection established - messages reset");
98102
};
99103

100104
// Handle connection errors

0 commit comments

Comments
 (0)