Skip to content

Commit 2bb1a62

Browse files
resolve copilot comment
1 parent 42b3e12 commit 2bb1a62

7 files changed

Lines changed: 16 additions & 20 deletions

File tree

src/frontend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Multi-stage Dockerfile for React frontend with Python backend support using UV
22

33
# Stage 1: Node build environment for React
4-
FROM node:18-alpine AS frontend-builder
4+
FROM node:20-alpine AS frontend-builder
55

66
WORKDIR /app/frontend
77

src/frontend/src/components/content/HomeInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ const HomeInput: React.FC<HomeInputProps> = ({ selectedTeam }) => {
122122
try {
123123
// errorDetail = JSON.parse(error);
124124
errorMessage = error?.message || errorMessage;
125-
} catch {
126-
// ignore parse error
125+
} catch (parseError) {
126+
console.error("Error parsing error response", parseError);
127127
}
128128

129129
showToast(errorMessage, "error");

src/frontend/src/coral/modules/Chat.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ const Chat: React.FC<ChatProps> = ({
6262
}
6363
// const chatMessages = await chatService.getUserHistory(userId);
6464
// setMessages(chatMessages);
65-
} catch {
65+
} catch (error) {
6666
// Failed to load history — silent fail
67+
console.log("Failed to load chat history for user", userId);
6768
}
6869
};
6970
loadHistory();
@@ -170,6 +171,7 @@ const Chat: React.FC<ChatProps> = ({
170171
setMessages([]);
171172
} catch {
172173
// clear history failed — silent
174+
console.log("Failed to clear chat history for user", userId);
173175
}
174176
};
175177

src/frontend/src/hooks/usePlanWebSocket.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@ import webSocketService from '@/services/WebSocketService';
1010
import { PlanDataService } from '@/services/PlanDataService';
1111
import { useAppDispatch, useAppSelector } from '@/state/hooks';
1212
import {
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';
3226
import {
3327
appendToStreamingBuffer,
@@ -46,6 +40,7 @@ import {
4640
PlanStatus,
4741
ParsedUserClarification,
4842
StreamMessage,
43+
ProcessedPlanData,
4944
} from '@/models';
5045
import { APIService } from '@/api/apiService';
5146

@@ -65,11 +60,13 @@ interface UsePlanWebSocketProps {
6560
*/
6661
function 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();

src/frontend/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ const AppWrapper = () => {
4040
window.userInfo = defaultUserInfo;
4141
setUserInfoGlobal(defaultUserInfo);
4242
await apiService.sendUserBrowserLanguage();
43-
} catch {
44-
// Config endpoint not available — using defaults
43+
} catch (error) {
44+
console.info("frontend config did not load from python", error);
4545
} finally {
4646
setIsConfigLoaded(true);
4747
setIsUserInfoLoaded(true);

src/frontend/src/pages/HomePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const HomePage: React.FC = () => {
129129
showToast(`Team uploaded successfully! ${defaultTeam.name} remains your default team.`, 'success');
130130
}
131131
} catch {
132-
// Silently handle — toast was already shown for upload success
132+
console.error('Team upload failed');
133133
}
134134
}, [dispatch, showToast]);
135135

src/frontend/src/pages/PlanPage.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useEffect, useMemo } from 'react';
1+
import React, { useCallback, useEffect} from 'react';
22
import { useParams, useNavigate } from 'react-router-dom';
33
import { Spinner, Text } from '@fluentui/react-components';
44

@@ -11,8 +11,6 @@ import webSocketService from '../services/WebSocketService';
1111
import {
1212
AgentMessageData,
1313
AgentMessageType,
14-
PlanStatus,
15-
PlanApprovalRequest,
1614
} from '../models';
1715

1816
/* ── Redux ───────────────────────────────────────────────────── */
@@ -37,7 +35,6 @@ import {
3735
setCancellingPlan,
3836
setLoadingMessage,
3937
setErrorLoading,
40-
setPlanData,
4138
planApprovalAccepted,
4239
planApprovalRejected,
4340
} from '../state/slices/planSlice';

0 commit comments

Comments
 (0)