Skip to content

Commit 176de8b

Browse files
committed
revert: restore timerStartTime pattern for message components
Revert from passing full timer object to passing just timerStartTime to message components. This matches the original implementation where only the start time was passed down the component tree, while StatusIndicator keeps the full timer object for elapsed time display. Changes: - MessageRenderer now accepts timerStartTime instead of timer - MessageBlock uses ElapsedTimer component with timerStartTime - StatusIndicator continues to use full timer object for elapsed seconds
1 parent 1ef50ec commit 176de8b

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

cli/src/chat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ export const Chat = ({
591591
collapsedAgents={collapsedAgents}
592592
streamingAgents={streamingAgents}
593593
isWaitingForResponse={isWaitingForResponse}
594-
timer={mainAgentTimer}
594+
timerStartTime={timerStartTime}
595595
setCollapsedAgents={setCollapsedAgents}
596596
setFocusedAgentId={setFocusedAgentId}
597597
userOpenedAgents={userOpenedAgents}

cli/src/components/message-renderer.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface MessageRendererProps {
2424
collapsedAgents: Set<string>
2525
streamingAgents: Set<string>
2626
isWaitingForResponse: boolean
27-
timer: any
27+
timerStartTime: number | null
2828
setCollapsedAgents: React.Dispatch<React.SetStateAction<Set<string>>>
2929
setFocusedAgentId: React.Dispatch<React.SetStateAction<string | null>>
3030
userOpenedAgents: Set<string>
@@ -45,7 +45,7 @@ export const MessageRenderer = (props: MessageRendererProps): ReactNode => {
4545
collapsedAgents,
4646
streamingAgents,
4747
isWaitingForResponse,
48-
timer,
48+
timerStartTime,
4949
setCollapsedAgents,
5050
setFocusedAgentId,
5151
setUserOpenedAgents,
@@ -54,8 +54,6 @@ export const MessageRenderer = (props: MessageRendererProps): ReactNode => {
5454
onBuildMax,
5555
} = props
5656

57-
const timerStartTime = timer?.startTime ?? null
58-
5957
const onToggleCollapsed = useCallback(
6058
(id: string) => {
6159
const wasCollapsed = collapsedAgents.has(id)
@@ -106,7 +104,7 @@ export const MessageRenderer = (props: MessageRendererProps): ReactNode => {
106104
setUserOpenedAgents={setUserOpenedAgents}
107105
setFocusedAgentId={setFocusedAgentId}
108106
isWaitingForResponse={isWaitingForResponse}
109-
timer={timer}
107+
timerStartTime={timerStartTime}
110108
onToggleCollapsed={onToggleCollapsed}
111109
onBuildFast={onBuildFast}
112110
onBuildMax={onBuildMax}
@@ -132,7 +130,7 @@ interface MessageWithAgentsProps {
132130
setUserOpenedAgents: React.Dispatch<React.SetStateAction<Set<string>>>
133131
setFocusedAgentId: React.Dispatch<React.SetStateAction<string | null>>
134132
isWaitingForResponse: boolean
135-
timer: any
133+
timerStartTime: number | null
136134
onToggleCollapsed: (id: string) => void
137135
onBuildFast: () => void
138136
onBuildMax: () => void
@@ -154,14 +152,13 @@ const MessageWithAgents = memo(
154152
setUserOpenedAgents,
155153
setFocusedAgentId,
156154
isWaitingForResponse,
157-
timer,
155+
timerStartTime,
158156
onToggleCollapsed,
159157
onBuildFast,
160158
onBuildMax,
161159
}: MessageWithAgentsProps): ReactNode => {
162160
const SIDE_GUTTER = 1
163161
const isAgent = message.variant === 'agent'
164-
const timerStartTime = timer?.startTime ?? null
165162

166163
if (isAgent) {
167164
return (
@@ -292,7 +289,7 @@ const MessageWithAgents = memo(
292289
isComplete={message.isComplete}
293290
completionTime={message.completionTime}
294291
credits={message.credits}
295-
timer={timer}
292+
timerStartTime={timerStartTime}
296293
textColor={textColor}
297294
timestampColor={timestampColor}
298295
markdownOptions={markdownOptions}
@@ -367,7 +364,7 @@ const MessageWithAgents = memo(
367364
setUserOpenedAgents={setUserOpenedAgents}
368365
setFocusedAgentId={setFocusedAgentId}
369366
isWaitingForResponse={isWaitingForResponse}
370-
timer={timer}
367+
timerStartTime={timerStartTime}
371368
onToggleCollapsed={onToggleCollapsed}
372369
onBuildFast={onBuildFast}
373370
onBuildMax={onBuildMax}
@@ -611,7 +608,7 @@ const AgentMessage = memo(
611608
setUserOpenedAgents={setUserOpenedAgents}
612609
setFocusedAgentId={setFocusedAgentId}
613610
isWaitingForResponse={isWaitingForResponse}
614-
timer={timer}
611+
timerStartTime={timerStartTime}
615612
onToggleCollapsed={onToggleCollapsed}
616613
onBuildFast={onBuildFast}
617614
onBuildMax={onBuildMax}

0 commit comments

Comments
 (0)