diff --git a/src/container/GraphView/index.tsx b/src/container/GraphView/index.tsx index b8503fc7..18ad2ed7 100644 --- a/src/container/GraphView/index.tsx +++ b/src/container/GraphView/index.tsx @@ -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]);