xyflow icon indicating copy to clipboard operation
xyflow copied to clipboard

feat(store): cancelConnection method created

Open Alireza29675 opened this issue 2 years ago • 3 comments

This is a way to cancel the dragging connection if needed.

For example, in our project, we need to cancel the connection when ESC is pressed. It can be done like this:

const { cancelConnection } = useStore();

useEscPress(() => cancelConnection(), [cancelConnection]);

@moklick, if this is fine in general:

  1. is there any specific example in mind to add this one to, or should we make a separate example for it?
  2. What is the e2e and unit testing conventions in your team?

Alireza29675 avatar Sep 20 '22 12:09 Alireza29675

Hey @Alireza29675

thanks for your PR :) I think it's a good addition, but could you do it against the v11 branch? I don't want to add any new features to v10. More over I am not sure what would be the best way to expose this to the user. Having it as a store action only, it would be a bit hidden, but also fine.. However it would be OK for me to start with this kind of implementation even if it's a bit hidden.

  1. A new cancel connection example would be best
  2. At least one unit test would be great here

moklick avatar Sep 20 '22 13:09 moklick

@moklick Hei Moritz!

Sure. We can implement it in the store and use the method for other internal implementations. I'll move it to v11.

Alireza29675 avatar Sep 20 '22 14:09 Alireza29675

k, thanks!

moklick avatar Sep 20 '22 14:09 moklick