fix(flowsContext.tsx): add a setTimeout to prevent updating state with wrong data
The setTimeout function is added to delay the execution of the addFlowToLocalState function by 200 milliseconds. This is done to prevent updating the state with incorrect data.
This commit is contained in:
parent
617acef214
commit
6b2f432327
1 changed files with 5 additions and 1 deletions
|
|
@ -538,7 +538,11 @@ export function FlowsProvider({ children }: { children: ReactNode }) {
|
|||
const newFlow = createNewFlow(flowData, flow!);
|
||||
const { id } = await saveFlowToDatabase(newFlow);
|
||||
newFlow.id = id;
|
||||
addFlowToLocalState(newFlow);
|
||||
//setTimeout to prevent update state with wrong state
|
||||
setTimeout(() => {
|
||||
addFlowToLocalState(newFlow);
|
||||
}, 200);
|
||||
// addFlowToLocalState(newFlow);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue