From 1770e95d0a6cc6e63b72ccf0c1e673d32a5cde0e Mon Sep 17 00:00:00 2001 From: Nicolas Varrot Date: Fri, 13 Feb 2026 03:41:39 +0000 Subject: [PATCH] fix: resolve all ESLint warnings (setState in useEffect) Suppress 3 react-hooks/set-state-in-effect warnings with targeted eslint-disable comments. These are intentional patterns: - ChatInput: restore draft text on session switch - MessageSearch: reset active index on query change - ToolCall: sync open state with global collapse/expand toggle Lint now passes with 0 errors and 0 warnings. --- src/components/ChatInput.tsx | 2 +- src/components/MessageSearch.tsx | 2 +- src/components/ToolCall.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/ChatInput.tsx b/src/components/ChatInput.tsx index 55cff41..08c1dc5 100644 --- a/src/components/ChatInput.tsx +++ b/src/components/ChatInput.tsx @@ -114,7 +114,7 @@ export function ChatInput({ onSend, onAbort, isGenerating, disabled, sessionKey } // Restore draft for the new session const draft = sessionKey ? draftsRef.current.get(sessionKey) ?? '' : ''; - setText(draft); + setText(draft); // eslint-disable-line react-hooks/set-state-in-effect -- intentional: restore draft on session switch prevSessionRef.current = sessionKey; }, [sessionKey]); // eslint-disable-line react-hooks/exhaustive-deps diff --git a/src/components/MessageSearch.tsx b/src/components/MessageSearch.tsx index 8b78ca6..3c3f6e7 100644 --- a/src/components/MessageSearch.tsx +++ b/src/components/MessageSearch.tsx @@ -28,7 +28,7 @@ export function MessageSearch({ open, onClose, onSearch, matchCount }: Props) { // Reset active index when query changes useEffect(() => { - setActiveIndex(0); + setActiveIndex(0); // eslint-disable-line react-hooks/set-state-in-effect -- intentional: reset index on query change }, [query]); const navigate = useCallback((dir: 1 | -1) => { diff --git a/src/components/ToolCall.tsx b/src/components/ToolCall.tsx index b1ac34f..eee7a23 100644 --- a/src/components/ToolCall.tsx +++ b/src/components/ToolCall.tsx @@ -243,7 +243,7 @@ export function ToolCall({ name, input, result }: { name: string; input?: Record useEffect(() => { if (version !== lastVersion.current) { lastVersion.current = version; - if (globalState === 'collapse-all') setOpen(false); + if (globalState === 'collapse-all') setOpen(false); // eslint-disable-line react-hooks/set-state-in-effect -- intentional: sync with global toggle else if (globalState === 'expand-all') setOpen(true); } }, [globalState, version]);