From 6e36d12819708e98a377fc9b1179357fc62adefb Mon Sep 17 00:00:00 2001 From: Christian Rey Villablanca Date: Tue, 4 Aug 2026 13:37:49 +0800 Subject: [PATCH] fix(chat): place loading status after response --- .../live-stream-response-rendering.test.mjs | 11 +++++++ webview/shared/src/chat/MessageComponents.tsx | 31 +++++++------------ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/tests/webview/live-stream-response-rendering.test.mjs b/tests/webview/live-stream-response-rendering.test.mjs index 09f652a..2ca5169 100644 --- a/tests/webview/live-stream-response-rendering.test.mjs +++ b/tests/webview/live-stream-response-rendering.test.mjs @@ -321,6 +321,17 @@ test("the live response card owns the AI loading text until its response finishe ); }); +test("the live loading text follows the response card", () => { + const responseSectionIndex = messageSource.lastIndexOf( + 'data-assistant-section="response"', + ); + const loadingTextIndex = messageSource.indexOf( + 'data-assistant-section="live-loading-text"', + ); + assert.ok(responseSectionIndex >= 0, "the assistant response section must render"); + assert.ok(loadingTextIndex > responseSectionIndex, "the loading text must render below the latest response card"); +}); + test("active assistant cards do not use intrinsic virtualization height", () => { assert.match( messageSource, diff --git a/webview/shared/src/chat/MessageComponents.tsx b/webview/shared/src/chat/MessageComponents.tsx index 0dc3c87..911c720 100644 --- a/webview/shared/src/chat/MessageComponents.tsx +++ b/webview/shared/src/chat/MessageComponents.tsx @@ -12664,26 +12664,6 @@ const hasVisibleResponseSectionContent = ); })} - {/* - * Keep the live status text attached to the assistant card. - * The ticker used to be mounted only by the session-switch - * spinner, so normal SSE responses could lose the loading - * text while their activity rows were still streaming. It - * must not be rendered in the composer: mounting it here - * preserves the card's ownership and prevents a response - * rerender from moving the scroll target to the user prompt. - */} - {shouldShowLiveLoadingText ? ( -
- -
- ) : null} - )} @@ -12852,6 +12832,17 @@ const hasVisibleResponseSectionContent = /> )} + {shouldShowLiveLoadingText ? ( +
+ +
+ ) : null} + {/* Block-level pill for the last card in a multi-card block. When expanded: shows a single Collapse link at the very end to fold the whole block. */} {isLastInBlock && blockSize > 1 && !isBlockStreaming && isBlockExpanded && (