react-flow-chart icon indicating copy to clipboard operation
react-flow-chart copied to clipboard

onLinkComplete triggers onCanvasClick

Open kcvin94 opened this issue 5 years ago • 0 comments

I have a sidebar ui/ux (like this example https://github.com/MrBlenny/react-flow-chart/blob/master/stories/DragAndDropSidebar.tsx) and have made it so that when the user clicks on a Node, it sets it as selected and thus showing some data of that Node in the sidebar. Then, I added to onCanvasClick to simply clear selected. This all works great, but the issue is when there is some Node selected, and therefore its data is showing in my sidebar, and then the user creates a new Link, and unexpectedly the selected is cleared.

Is there a way to prevent onCanvasClick from triggering when onLinkComplete fires?

Note: onCanvasClick does NOT trigger when onLinkStart or onLinkCancel fires.

Edit: Also I've noticed the same issue for onDragCanvasStop (when using mouse at least)

kcvin94 avatar Jun 18 '20 08:06 kcvin94