Skip to content

Commit 55dbd6d

Browse files
authored
fix(web-ui): resolve react-hooks/exhaustive-deps warnings (#682) (#698)
Resolve the 3 remaining react-hooks/exhaustive-deps warnings (the other 4 from the issue were cleared by #658's eslint-10 upgrade) and enforce --max-warnings 0 to prevent regressions: - proof/[req_id]/page.tsx: add reqId to mount effect deps - BatchExecutionMonitor: hoist batchStatus, depend on it (preserves status-only re-run intent) - DiscoveryPanel: reorder startNewSession before initSession, add to deps - package.json: lint now runs with --max-warnings 0 Closes #682
1 parent a80d527 commit 55dbd6d

4 files changed

Lines changed: 28 additions & 26 deletions

File tree

web-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "eslint .",
9+
"lint": "eslint . --max-warnings 0",
1010
"test": "jest",
1111
"test:watch": "jest --watch",
1212
"test:coverage": "jest --coverage",

web-ui/src/app/proof/[req_id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default function ProofDetailPage() {
8585
setFilterGate(saved.gate);
8686
setFilterResult(saved.result);
8787
setSearch(saved.search);
88-
}, []);
88+
}, [reqId]);
8989

9090
const { data: req, error: reqError, isLoading: reqLoading, mutate: mutateReq } =
9191
useSWR<ProofRequirement>(

web-ui/src/components/execution/BatchExecutionMonitor.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,16 @@ export function BatchExecutionMonitor({ batchId, workspacePath }: BatchExecution
8888
}, [batchId, workspacePath]); // eslint-disable-line react-hooks/exhaustive-deps
8989

9090
// Poll every 5 seconds while batch is active
91+
const batchStatus = batch?.status;
9192
useEffect(() => {
92-
const isActive = batch && !['COMPLETED', 'FAILED', 'CANCELLED'].includes(batch.status);
93+
const isActive = batchStatus && !['COMPLETED', 'FAILED', 'CANCELLED'].includes(batchStatus);
9394
if (isActive) {
9495
pollRef.current = setInterval(fetchBatch, 5000);
9596
}
9697
return () => {
9798
if (pollRef.current) clearInterval(pollRef.current);
9899
};
99-
}, [batch?.status, fetchBatch]);
100+
}, [batchStatus, fetchBatch]);
100101

101102
// Note: batch.completed / blocker.created notifications are dispatched by the
102103
// cross-page background watcher in NotificationProvider (issue #652), so they

web-ui/src/components/prd/DiscoveryPanel.tsx

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,28 @@ export function DiscoveryPanel({
4848
const [error, setError] = useState<string | null>(null);
4949
const [pendingSession, setPendingSession] = useState<PendingSession | null>(null);
5050

51+
// ─── Start a brand-new session ─────────────────────────────────
52+
// Declared before initSession so it can be a stable dependency of it.
53+
const startNewSession = useCallback(async () => {
54+
setError(null);
55+
setPendingSession(null);
56+
try {
57+
const resp = await discoveryApi.start(workspacePath);
58+
setSessionId(resp.session_id);
59+
setState('discovering');
60+
setMessages([
61+
{
62+
role: 'assistant',
63+
content: questionText(resp.question),
64+
timestamp: now(),
65+
},
66+
]);
67+
} catch (err) {
68+
const apiErr = err as ApiError;
69+
setError(apiErr.detail || 'Failed to start discovery session');
70+
}
71+
}, [workspacePath]);
72+
5173
// ─── Initialise: check for existing session before starting ────
5274
const initSession = useCallback(async () => {
5375
setIsThinking(true);
@@ -80,28 +102,7 @@ export function DiscoveryPanel({
80102
} finally {
81103
setIsThinking(false);
82104
}
83-
}, [workspacePath]);
84-
85-
// ─── Start a brand-new session ─────────────────────────────────
86-
const startNewSession = useCallback(async () => {
87-
setError(null);
88-
setPendingSession(null);
89-
try {
90-
const resp = await discoveryApi.start(workspacePath);
91-
setSessionId(resp.session_id);
92-
setState('discovering');
93-
setMessages([
94-
{
95-
role: 'assistant',
96-
content: questionText(resp.question),
97-
timestamp: now(),
98-
},
99-
]);
100-
} catch (err) {
101-
const apiErr = err as ApiError;
102-
setError(apiErr.detail || 'Failed to start discovery session');
103-
}
104-
}, [workspacePath]);
105+
}, [workspacePath, startNewSession]);
105106

106107
// ─── Resume an existing session ────────────────────────────────
107108
const resumeSession = useCallback(() => {

0 commit comments

Comments
 (0)