From a7df671144186a18912c2b87d85f29557c6fa0ce Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Fri, 28 Nov 2025 19:05:41 +0000 Subject: [PATCH] fix(app): deduplicate tool call expansion sections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Command output was being shown three times: as "Command", as "Read Result", and as raw JSON "Result". Now: - Skip "Read Result" when command output is already shown - Skip raw JSON "Result" when we have structured content to display 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- packages/app/src/components/message.tsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/app/src/components/message.tsx b/packages/app/src/components/message.tsx index 2efc78b84..c25dba5b7 100644 --- a/packages/app/src/components/message.tsx +++ b/packages/app/src/components/message.tsx @@ -1391,25 +1391,34 @@ export const ToolCall = memo(function ToolCall({ [readEntries] ); + // Check if we have structured content that makes raw JSON redundant + const hasStructuredContent = Boolean( + commandDetails?.output || editEntries.length > 0 || readEntries.length > 0 + ); + const jsonSections = useMemo(() => { const sections: ReactNode[] = []; if (args !== undefined) { sections.push(renderJsonSection("Arguments", serializedArgs)); } - if (result !== undefined) { + // Only show raw Result JSON if we don't have structured content showing the same data + if (result !== undefined && !hasStructuredContent) { sections.push(renderJsonSection("Result", serializedResult)); } if (error !== undefined) { sections.push(renderJsonSection("Error", serializedError, true)); } return sections; - }, [args, serializedArgs, result, serializedResult, error, serializedError]); + }, [args, serializedArgs, result, serializedResult, error, serializedError, hasStructuredContent]); const renderDetails = useCallback(() => { + // Don't show readSections if commandDetails has output (they show the same data) + const showReadSections = !commandDetails?.output && readSections.length > 0; + if ( !commandSection && editSections.length === 0 && - readSections.length === 0 && + !showReadSections && jsonSections.length === 0 ) { return ( @@ -1423,11 +1432,11 @@ export const ToolCall = memo(function ToolCall({ {commandSection} {editSections} - {readSections} + {showReadSections ? readSections : null} {jsonSections} ); - }, [commandSection, editSections, readSections, jsonSections]); + }, [commandSection, commandDetails?.output, editSections, readSections, jsonSections]); return (