useEffect errors fixed
This commit is contained in:
parent
fc0fe8f5b8
commit
d5fa65ed3f
2 changed files with 7 additions and 9 deletions
|
|
@ -25,8 +25,6 @@ export default function App() {
|
|||
setIsStackedOpen(true);
|
||||
}, [location.pathname, setCurrent, setIsStackedOpen, setShowSideBar]);
|
||||
|
||||
const {dark} = useContext(darkContext);
|
||||
|
||||
const {
|
||||
errorData,
|
||||
errorOpen,
|
||||
|
|
|
|||
|
|
@ -46,10 +46,6 @@ export default function FlowPage({ flow }:{flow:FlowType}) {
|
|||
useContext(typesContext);
|
||||
const reactFlowWrapper = useRef(null);
|
||||
|
||||
function getId() {
|
||||
return `dndnode_` + incrementNodeId();
|
||||
}
|
||||
|
||||
const { setExtraComponent, setExtraNavigation } = useContext(locationContext);
|
||||
const { setErrorData } = useContext(alertContext);
|
||||
|
||||
|
|
@ -66,7 +62,7 @@ export default function FlowPage({ flow }:{flow:FlowType}) {
|
|||
flow.data = reactFlowInstance.toObject();
|
||||
updateFlow(flow);
|
||||
}
|
||||
}, [nodes, edges]);
|
||||
}, [nodes, edges, reactFlowInstance, flow, updateFlow]);
|
||||
|
||||
useEffect(() => {
|
||||
setNodes(flow?.data?.nodes ?? []);
|
||||
|
|
@ -74,7 +70,7 @@ export default function FlowPage({ flow }:{flow:FlowType}) {
|
|||
if (reactFlowInstance) {
|
||||
setViewport(flow?.data?.viewport ?? { x: 1, y: 0, zoom: 1 });
|
||||
}
|
||||
}, [flow, reactFlowInstance, setEdges, setNodes]);
|
||||
}, [flow, reactFlowInstance, setEdges, setNodes, setViewport]);
|
||||
|
||||
useEffect(() => {
|
||||
setExtraComponent(<ExtraSidebar />);
|
||||
|
|
@ -114,6 +110,10 @@ export default function FlowPage({ flow }:{flow:FlowType}) {
|
|||
(event:React.DragEvent) => {
|
||||
event.preventDefault();
|
||||
|
||||
function getId() {
|
||||
return `dndnode_` + incrementNodeId();
|
||||
}
|
||||
|
||||
const reactflowBounds = reactFlowWrapper.current.getBoundingClientRect();
|
||||
let data:{type:string,node?:APIClassType} = JSON.parse(event.dataTransfer.getData("json"));
|
||||
if (
|
||||
|
|
@ -154,7 +154,7 @@ export default function FlowPage({ flow }:{flow:FlowType}) {
|
|||
});
|
||||
}
|
||||
},
|
||||
[reactFlowInstance, setErrorData, setNodes]
|
||||
[incrementNodeId, reactFlowInstance, setErrorData, setNodes]
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue