Skip to content

Commit 4443719

Browse files
committed
fix: use safeRenderValue consistently for all content types
The isJsonObject branch was bypassing safeRenderValue and calling JSON.stringify directly, which displayed raw JSON for structured objects like { text, type } instead of extracting the text field. Now all content goes through safeRenderValue which extracts .text from content blocks and falls back to JSON.stringify only when no text field is found. Addresses review feedback from Greptile and Cursor bots. AI Disclosure: This commit was authored by Claude Opus 4.6 (Anthropic), an AI agent operated by Maxwell Calkin (@MaxwellCalkin).
1 parent e0dd596 commit 4443719

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

apps/sim/app/chat/components/message/message.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ export const ClientChatMessage = memo(
5353

5454
// Safely convert content to a renderable string to prevent React error #31
5555
// when workflow nodes return structured objects (e.g. { text, type })
56-
const cleanTextContent = useMemo(() => {
57-
if (isJsonObject) {
58-
return JSON.stringify(message.content, null, 2)
59-
}
60-
return safeRenderValue(message.content)
61-
}, [message.content, isJsonObject])
56+
// Use safeRenderValue for all content types — it extracts .text from
57+
// structured objects like { text, type } and falls back to JSON.stringify
58+
const cleanTextContent = useMemo(
59+
() => safeRenderValue(message.content),
60+
[message.content]
61+
)
6262

6363
const content =
6464
message.type === 'user' ? (

0 commit comments

Comments
 (0)