Bugfix: Update onConnect

Will call setOnConnect if function passed as onConnect changes
This commit is contained in:
Andy
2020-07-28 00:48:13 +02:00
committed by andys8
parent 06a95b893c
commit 7bfa18f506
+6 -4
View File
@@ -142,10 +142,6 @@ const GraphView = memo(
updateDimensions();
window.onresize = updateDimensions;
if (onConnect) {
setOnConnect(onConnect);
}
if (rendererNode.current) {
resizeObserver = new ResizeObserver((entries) => {
for (let _ of entries) {
@@ -201,6 +197,12 @@ const GraphView = memo(
}
}, [d3Initialised, onLoad]);
useEffect(() => {
if (onConnect) {
setOnConnect(onConnect);
}
}, [onConnect]);
useEffect(() => {
setSnapGrid({ snapToGrid, snapGrid });
}, [snapToGrid]);