From 9055d70eb7ba8916c9ac4692241d53a49bab5484 Mon Sep 17 00:00:00 2001 From: GCWing Date: Mon, 9 Mar 2026 09:19:13 +0800 Subject: [PATCH] fix: resolve currentImageCount TDZ error in ChatInput Made-with: Cursor --- src/web-ui/src/flow_chat/components/ChatInput.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/web-ui/src/flow_chat/components/ChatInput.tsx b/src/web-ui/src/flow_chat/components/ChatInput.tsx index a61f943a..27923140 100644 --- a/src/web-ui/src/flow_chat/components/ChatInput.tsx +++ b/src/web-ui/src/flow_chat/components/ChatInput.tsx @@ -62,6 +62,11 @@ export const ChatInput: React.FC = ({ const addContext = useContextStore(state => state.addContext); const removeContext = useContextStore(state => state.removeContext); const clearContexts = useContextStore(state => state.clearContexts); + + const currentImageCount = useMemo( + () => contexts.filter(c => c.type === 'image').length, + [contexts], + ); const activeSessionState = useActiveSessionState(); const currentSessionId = activeSessionState.sessionId; @@ -753,11 +758,6 @@ export const ChatInput: React.FC = ({ transition(SessionExecutionEvent.USER_CANCEL); } }, [handleSendOrCancel, derivedState, transition, templateState.fillState, moveToNextPlaceholder, moveToPrevPlaceholder, exitTemplateMode, slashCommandState, getFilteredModes, selectSlashCommandMode, canSwitchModes]); - - const currentImageCount = useMemo( - () => contexts.filter(c => c.type === 'image').length, - [contexts], - ); const handleImageInput = useCallback(() => { const remaining = CHAT_INPUT_CONFIG.image.maxCount - currentImageCount;