From 939af59950b9a8720cc3c0de8599a2141281f81e Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Sun, 24 Aug 2025 12:42:34 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=84=E2=80=8D=E2=99=82=EF=B8=8F=20refac?= =?UTF-8?q?tor:=20Improve=20Cancelled=20Stream=20Handling=20for=20Pending?= =?UTF-8?q?=20Authentication=20(#9235)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/hooks/SSE/useEventHandlers.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/client/src/hooks/SSE/useEventHandlers.ts b/client/src/hooks/SSE/useEventHandlers.ts index 5d459b844c..1d860fbb7a 100644 --- a/client/src/hooks/SSE/useEventHandlers.ts +++ b/client/src/hooks/SSE/useEventHandlers.ts @@ -480,12 +480,13 @@ export default function useEventHandlers({ queryClient.setQueryData([QueryKeys.messages, id], _messages); }; - /** Handle edge case where stream is cancelled before any response, which creates a blank page */ - if ( - !conversation.conversationId && + const hasNoResponse = responseMessage?.content?.[0]?.['text']?.value === - submission.initialResponse?.content?.[0]?.['text']?.value - ) { + submission.initialResponse?.content?.[0]?.['text']?.value || + !!responseMessage?.content?.[0]?.['tool_call']?.auth; + + /** Handle edge case where stream is cancelled before any response, which creates a blank page */ + if (!conversation.conversationId && hasNoResponse) { const currentConvoId = (submissionConvo.conversationId ?? conversation.conversationId) || Constants.NEW_CONVO; if (isNewConvo && submissionConvo.conversationId) {