From dcc2b466d723fc0ef3f668d62febb7850624e8ce Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Mon, 13 Nov 2023 15:25:41 +0700 Subject: [PATCH] Using some function instead filter --- web/screens/Chat/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/screens/Chat/index.tsx b/web/screens/Chat/index.tsx index fbdeac519..8723545fc 100644 --- a/web/screens/Chat/index.tsx +++ b/web/screens/Chat/index.tsx @@ -56,7 +56,7 @@ const ChatScreen = () => { const conversations = useAtomValue(userConversationsAtom) const isEnableChat = (currentConvo && activeModel) || conversations.length > 0 const [isModelAvailable, setIsModelAvailable] = useState( - downloadedModels.filter((x) => x.name === currentConvo?.name).length === 0 + downloadedModels.some((x) => x.name !== currentConvo?.name) ) const textareaRef = useRef(null) @@ -72,7 +72,7 @@ const ChatScreen = () => { useEffect(() => { setIsModelAvailable( - downloadedModels.filter((x) => x.name === currentConvo?.name).length === 0 + downloadedModels.some((x) => x.name !== currentConvo?.name) ) // eslint-disable-next-line react-hooks/exhaustive-deps }, [currentConvo, downloadedModels])