From 8b69e2a8b516c05123061f29d1dfab02cf302bce Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:17:09 -0400 Subject: [PATCH] Fix row collapse logic --- webview-ui/src/components/chat/ChatView.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 67d7c52..c181813 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -384,7 +384,8 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie const isCollapsing = expandedRows[ts] ?? false const isLast = visibleMessages.at(-1)?.ts === ts const isSecondToLast = visibleMessages.at(-2)?.ts === ts - const isLastCollapsed = !expandedRows[visibleMessages.at(-1)?.ts ?? 0] + const isLastCollapsedApiReq = + visibleMessages.at(-1)?.say === "api_req_started" && !expandedRows[visibleMessages.at(-1)?.ts ?? 0] setExpandedRows((prev) => ({ ...prev, [ts]: !prev[ts], @@ -400,7 +401,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie return () => clearTimeout(timer) } else if (isLast || isSecondToLast) { if (isCollapsing) { - if (isSecondToLast && !isLastCollapsed) { + if (isSecondToLast && !isLastCollapsedApiReq) { return } const timer = setTimeout(() => {