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.
This commit is contained in:
Danny Avila 2025-12-12 01:43:40 -05:00
parent 08052844cf
commit b8fa8eb316
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956

View file

@ -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;
}