@@ -46,6 +46,7 @@ import {
4646} from '@/models' ;
4747import { APIService } from '@/api/apiService' ;
4848import { ToastIntent } from '@/components/toast/InlineToaster' ;
49+ import { formatElapsedTime } from '@/utils' ;
4950
5051const apiService = new APIService ( ) ;
5152
@@ -57,16 +58,6 @@ interface UsePlanWebSocketProps {
5758 showToast : ( content : React . ReactNode , intent ?: ToastIntent , options ?: { dismissible ?: boolean ; timeoutMs ?: number | null } ) => number ;
5859}
5960
60- const formatElapsedTime = ( elapsedSeconds : number ) : string => {
61- if ( elapsedSeconds < 60 ) {
62- return `${ elapsedSeconds } s` ;
63- }
64-
65- const minutes = Math . floor ( elapsedSeconds / 60 ) ;
66- const seconds = elapsedSeconds % 60 ;
67- return `${ minutes } min ${ seconds } sec` ;
68- } ;
69-
7061/**
7162 * Creates an AgentMessageResponse and persists it, then optionally reloads the task list.
7263 */
@@ -115,8 +106,12 @@ export function usePlanWebSocket({
115106 const processingStartedAtRef = React . useRef < number | null > ( null ) ;
116107
117108 useEffect ( ( ) => {
118- if ( showProcessingPlanSpinner && processingStartedAtRef . current === null ) {
119- processingStartedAtRef . current = Date . now ( ) ;
109+ if ( showProcessingPlanSpinner ) {
110+ if ( processingStartedAtRef . current === null ) {
111+ processingStartedAtRef . current = Date . now ( ) ;
112+ }
113+ } else {
114+ processingStartedAtRef . current = null ;
120115 }
121116 } , [ showProcessingPlanSpinner ] ) ;
122117
@@ -282,7 +277,6 @@ export function usePlanWebSocket({
282277 } ;
283278 dispatch ( addAgentMessage ( errorAgent ) ) ;
284279 dispatch ( planFailedFinal ( ) ) ;
285- dispatch ( setShowProcessingPlanSpinner ( false ) ) ;
286280 processingStartedAtRef . current = null ;
287281 dispatch ( setShowBufferingText ( false ) ) ;
288282 dispatch ( setSubmittingChatDisableInput ( true ) ) ;
0 commit comments