Closed
Description
The events onConnectStart
, onConnectEnd
, onDrop
, onDragOver
, onNodeDrag
, onNodeDragStart
, onNodeDragStop
should be wrapped in a useCallback
to avoid unnecessary rendering.
The way we calculate drop position is costly since we're using useViewport()
and that fonction is making components rerender with each change of the viewport. Since we need to have the actual viewport only when the drop is applied we should use screenToFlowPosition
from ReactFlowInstance