From 43b74b4aa80c66fb9559232fbe46b96d4b4b961a Mon Sep 17 00:00:00 2001 From: DDDDD12138 Date: Sun, 15 Sep 2024 21:47:32 +0800 Subject: [PATCH] fix: resolve useEffect dependency warnings --- app/components/chat.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 17f8d3a34..316466ee7 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -510,12 +510,14 @@ export function ChatActions(props: { const isMobileScreen = useMobileScreen(); + const { setAttachImages, setUploading } = props; + useEffect(() => { const show = isVisionModel(currentModel); setShowUploadImage(show); if (!show) { - props.setAttachImages([]); - props.setUploading(false); + setAttachImages([]); + setUploading(false); } // if current model is not available @@ -535,7 +537,7 @@ export function ChatActions(props: { : nextModel.name, ); } - }, [chatStore, currentModel, models]); + }, [chatStore, currentModel, models, setAttachImages, setUploading]); return (