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