From 4c46b89fc8547670d13e854e4c9e353b5861d6fa Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Fri, 12 Dec 2025 01:43:40 -0500 Subject: [PATCH] fix: Improve content type mismatch handling in useStepHandler - Enhanced the condition for detecting content type mismatches to include additional checks, ensuring more robust validation of content types before processing updates. --- client/src/hooks/SSE/useStepHandler.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/hooks/SSE/useStepHandler.ts b/client/src/hooks/SSE/useStepHandler.ts index bf9a0d024b..f2c91820df 100644 --- a/client/src/hooks/SSE/useStepHandler.ts +++ b/client/src/hooks/SSE/useStepHandler.ts @@ -101,8 +101,13 @@ export default function useStepHandler({ } /** Prevent overwriting an existing content part with a different type */ const existingType = (updatedContent[index]?.type as string | undefined) ?? ''; - if (existingType && !contentType.startsWith(existingType)) { - console.warn('Content type mismatch'); + if ( + existingType && + existingType !== contentType && + !contentType.startsWith(existingType) && + !existingType.startsWith(contentType) + ) { + console.warn('Content type mismatch', { existingType, contentType, index }); return message; }