From 809167d7a5cfb104705e229d2b83c30ec69a58da Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 21 Oct 2025 19:01:02 +0000 Subject: [PATCH 1/2] fix: add expand/collapse functionality to API Request section - Replace static double-arrow icon with expandable chevron for completed API requests - Add click handler to toggle expansion state - Display API request details in CodeAccordian when expanded - Maintain consistent UI behavior with other expandable sections Fixes #8755 --- webview-ui/src/components/chat/ChatRow.tsx | 86 +++++++++++++++++++++- 1 file changed, 83 insertions(+), 3 deletions(-) diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index b0b87e7a2dd..b10e5c67d98 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -1032,12 +1032,16 @@ export const ChatRowContent = ({ const isApiRequestInProgress = apiReqCancelReason === undefined && apiRequestFailedMessage === undefined && cost === undefined + // For completed requests (with cost), make them expandable + const isCompletedRequest = cost !== null && cost !== undefined + const canExpand = isCompletedRequest && message.text !== null && message.text !== undefined + return ( <>
+ }} + onClick={canExpand ? handleToggleExpand : undefined}>
- {icon} + {apiReqCancelReason !== null && apiReqCancelReason !== undefined ? ( + apiReqCancelReason === "user_cancelled" ? ( +
+ +
+ ) : ( +
+ +
+ ) + ) : canExpand ? ( +
+ +
+ ) : apiRequestFailedMessage ? ( +
+ +
+ ) : ( + + )} {title}
+ {/* Show API request details when expanded */} + {canExpand && isExpanded && message.text && ( +
+ {}} + /> +
+ )} {(((cost === null || cost === undefined) && apiRequestFailedMessage) || apiReqStreamingFailedMessage) && ( Date: Tue, 21 Oct 2025 19:13:06 +0000 Subject: [PATCH 2/2] refactor: address code review feedback - Remove code duplication in icon rendering logic - Use existing icon variable for non-expandable states - Fix CodeAccordion onToggleExpand handler --- webview-ui/src/components/chat/ChatRow.tsx | 55 ++-------------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index b10e5c67d98..f042f06db39 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -1053,41 +1053,8 @@ export const ChatRowContent = ({ }} onClick={canExpand ? handleToggleExpand : undefined}>
- {apiReqCancelReason !== null && apiReqCancelReason !== undefined ? ( - apiReqCancelReason === "user_cancelled" ? ( -
- -
- ) : ( -
- -
- ) - ) : canExpand ? ( + {/* Use chevron icon for expandable completed requests, otherwise use the computed icon */} + {canExpand ? (
- ) : apiRequestFailedMessage ? ( -
- -
) : ( - + icon )} {title}
@@ -1133,7 +1086,7 @@ export const ChatRowContent = ({ code={message.text} language="json" isExpanded={true} - onToggleExpand={() => {}} + onToggleExpand={handleToggleExpand} />
)}