diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx index f3174030ef..50559d402f 100644 --- a/apps/web/src/components/chat/MessagesTimeline.tsx +++ b/apps/web/src/components/chat/MessagesTimeline.tsx @@ -543,9 +543,10 @@ export const MessagesTimeline = memo(function MessagesTimeline({ - {row.createdAt - ? `Working for ${formatWorkingTimer(row.createdAt, nowIso) ?? "0s"}` - : "Working..."} + {(() => { + const elapsed = row.createdAt ? formatWorkingTimer(row.createdAt, nowIso) : null; + return elapsed ? `Working for ${elapsed}` : "Working..."; + })()} @@ -637,6 +638,9 @@ function formatWorkingTimer(startIso: string, endIso: string): string | null { } const elapsedSeconds = Math.max(0, Math.floor((endedAtMs - startedAtMs) / 1000)); + if (elapsedSeconds < 1) { + return null; + } if (elapsedSeconds < 60) { return `${elapsedSeconds}s`; }