From f2ff75ab295d6578e5357e43c433042051b48a70 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Thu, 2 Mar 2023 10:26:47 -0300 Subject: [PATCH] fixed loop on useEffect --- langflow/frontend/src/components/chatComponent/index.tsx | 5 +++-- langflow/frontend/src/pages/FlowPage/index.tsx | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/langflow/frontend/src/components/chatComponent/index.tsx b/langflow/frontend/src/components/chatComponent/index.tsx index 9a966f651..51c5c28ac 100644 --- a/langflow/frontend/src/components/chatComponent/index.tsx +++ b/langflow/frontend/src/components/chatComponent/index.tsx @@ -30,10 +30,11 @@ export default function Chat({flow, reactFlowInstance }:ChatType) { }; useEffect(()=>{ updateFlow({..._.cloneDeep(flow),chat:chatHistory}) - },[chatHistory, flow, saveChat, updateFlow]) + // eslint-disable-next-line react-hooks/exhaustive-deps + },[chatHistory, flow]) useEffect(()=>{ setChatHistory(flow.chat) - },[flow]) + },[flow.chat]) useEffect(()=>{ if(ref.current) ref.current.scrollIntoView({behavior: 'smooth'}); diff --git a/langflow/frontend/src/pages/FlowPage/index.tsx b/langflow/frontend/src/pages/FlowPage/index.tsx index cd2373f83..3e7100e5b 100644 --- a/langflow/frontend/src/pages/FlowPage/index.tsx +++ b/langflow/frontend/src/pages/FlowPage/index.tsx @@ -62,7 +62,8 @@ export default function FlowPage({ flow }:{flow:FlowType}) { flow.data = reactFlowInstance.toObject(); updateFlow(flow); } - }, [nodes, edges, reactFlowInstance, flow, updateFlow]); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [nodes, edges, reactFlowInstance, flow]); useEffect(() => { setNodes(flow?.data?.nodes ?? []);