fix(ui): Prevent infinite loop when displaying error toast in chat

This commit is contained in:
Richard Palethorpe
2025-04-01 21:54:59 +01:00
parent e90c192063
commit 7494aa9c26
2 changed files with 11 additions and 3 deletions

View File

@@ -150,6 +150,11 @@ export function useChat(agentName) {
localMessageContents.current.clear(); // Clear tracked local messages
}, []);
// Clear error state
const clearError = useCallback(() => {
setError(null);
}, []);
return {
messages,
sending,
@@ -157,5 +162,6 @@ export function useChat(agentName) {
isConnected,
sendMessage,
clearChat,
clearError,
};
}