fixed bug

This commit is contained in:
Lucas Oliveira 2023-03-02 18:28:58 -03:00
commit 7c682c5c56
2 changed files with 4 additions and 3 deletions

View file

@ -31,10 +31,10 @@ export default function Chat({flow, reactFlowInstance }:ChatType) {
useEffect(()=>{ useEffect(()=>{
updateFlow({..._.cloneDeep(flow),chat:chatHistory}) updateFlow({..._.cloneDeep(flow),chat:chatHistory})
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
},[chatHistory, flow]) },[saveChat])
useEffect(()=>{ useEffect(()=>{
setChatHistory(flow.chat) setChatHistory(flow.chat)
},[flow.chat]) },[flow])
useEffect(()=>{ useEffect(()=>{
if(ref.current) if(ref.current)
ref.current.scrollIntoView({behavior: 'smooth'}); ref.current.scrollIntoView({behavior: 'smooth'});

View file

@ -63,9 +63,10 @@ export default function FlowPage({ flow }:{flow:FlowType}) {
updateFlow(flow); updateFlow(flow);
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [nodes, edges, reactFlowInstance, flow]); }, [nodes, edges]);
useEffect(() => { useEffect(() => {
console.log('oi')
setNodes(flow?.data?.nodes ?? []); setNodes(flow?.data?.nodes ?? []);
setEdges(flow?.data?.edges ?? []); setEdges(flow?.data?.edges ?? []);
if (reactFlowInstance) { if (reactFlowInstance) {