@@ -10,13 +10,8 @@ import webSocketService from '@/services/WebSocketService';
1010import { PlanDataService } from '@/services/PlanDataService' ;
1111import { useAppDispatch , useAppSelector } from '@/state/hooks' ;
1212import {
13- setWaitingForPlan ,
1413 setShowProcessingPlanSpinner ,
15- setPlanApprovalRequest ,
16- setShowApprovalButtons ,
17- setContinueWithWebsocketFlow ,
1814 setReloadLeftList ,
19- markPlanCompleted ,
2015 selectPlanData ,
2116 selectContinueWithWebsocketFlow ,
2217 selectPlanApproved ,
@@ -27,7 +22,6 @@ import {
2722 setSubmittingChatDisableInput ,
2823 setClarificationMessage ,
2924 addAgentMessage ,
30- selectAgentMessages ,
3125} from '@/state/slices/chatSlice' ;
3226import {
3327 appendToStreamingBuffer ,
@@ -46,6 +40,7 @@ import {
4640 PlanStatus ,
4741 ParsedUserClarification ,
4842 StreamMessage ,
43+ ProcessedPlanData ,
4944} from '@/models' ;
5045import { APIService } from '@/api/apiService' ;
5146
@@ -65,11 +60,13 @@ interface UsePlanWebSocketProps {
6560 */
6661function persistAgentMessage (
6762 agentMessageData : AgentMessageData ,
68- planData : any ,
63+ planData : ProcessedPlanData | null ,
6964 dispatch : ReturnType < typeof useAppDispatch > ,
7065 isFinal = false ,
7166 streamingMessage = '' ,
7267) {
68+ if ( ! planData ?. plan ) return ;
69+
7370 const agentMessageResponse = PlanDataService . createAgentMessageResponse (
7471 agentMessageData ,
7572 planData ,
@@ -274,8 +271,8 @@ export function usePlanWebSocket({
274271 const connectWebSocket = async ( ) => {
275272 try {
276273 await webSocketService . connect ( planId ) ;
277- } catch {
278- // Continue without WebSocket — the app should still work
274+ } catch ( error ) {
275+ console . log ( ' WebSocket connection failed, continuing without real-time updates' , error ) ;
279276 }
280277 } ;
281278 connectWebSocket ( ) ;
0 commit comments