fixed loop on useEffect
This commit is contained in:
parent
1f63b31584
commit
f2ff75ab29
2 changed files with 5 additions and 3 deletions
|
|
@ -30,10 +30,11 @@ export default function Chat({flow, reactFlowInstance }:ChatType) {
|
||||||
};
|
};
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
updateFlow({..._.cloneDeep(flow),chat:chatHistory})
|
updateFlow({..._.cloneDeep(flow),chat:chatHistory})
|
||||||
},[chatHistory, flow, saveChat, updateFlow])
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
},[chatHistory, flow])
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
setChatHistory(flow.chat)
|
setChatHistory(flow.chat)
|
||||||
},[flow])
|
},[flow.chat])
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(ref.current)
|
if(ref.current)
|
||||||
ref.current.scrollIntoView({behavior: 'smooth'});
|
ref.current.scrollIntoView({behavior: 'smooth'});
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,8 @@ export default function FlowPage({ flow }:{flow:FlowType}) {
|
||||||
flow.data = reactFlowInstance.toObject();
|
flow.data = reactFlowInstance.toObject();
|
||||||
updateFlow(flow);
|
updateFlow(flow);
|
||||||
}
|
}
|
||||||
}, [nodes, edges, reactFlowInstance, flow, updateFlow]);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [nodes, edges, reactFlowInstance, flow]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setNodes(flow?.data?.nodes ?? []);
|
setNodes(flow?.data?.nodes ?? []);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue