Skip to content

Commit ecc9129

Browse files
committed
fix(frontend): show Thinking… placeholder between Send and first SSE event
Closes #127 Before this change, the live streaming area in Agent.tsx only rendered when streamingText was non-empty or toolCalls had at least one entry. The gap between handleSubmit setting status="streaming" and the first SSE event arriving left the chat area visually blank, making the UI look unresponsive on slow networks or long agent "thinking" time. Add a Thinking… placeholder that renders exactly during that gap (status === "streaming" && !streamingText && toolCalls.length === 0) and is implicitly hidden once the first SSE event populates either streaming state.
1 parent e99444d commit ecc9129

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

frontend/src/pages/Agent.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,17 @@ export function Agent() {
472472
);
473473
})}
474474

475+
{/* Pre-stream placeholder: visible after Send, before first SSE event */}
476+
{status === "streaming" && !streamingText && toolCalls.length === 0 && (
477+
<div className="flex gap-3">
478+
<AgentAvatar />
479+
<div className="flex-1 min-w-0 flex items-center gap-2 text-xs text-muted-foreground pt-1">
480+
<Loader2 className="h-3 w-3 animate-spin text-primary shrink-0" />
481+
<span>Thinking…</span>
482+
</div>
483+
</div>
484+
)}
485+
475486
{/* Live streaming area: text + tool status */}
476487
{(streamingText || (status === "streaming" && toolCalls.length > 0)) && (
477488
<div className="flex gap-3">

0 commit comments

Comments
 (0)