xyflow
xyflow copied to clipboard
feat(store): cancelConnection method created
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:
- is there any specific example in mind to add this one to, or should we make a separate example for it?
- What is the e2e and unit testing conventions in your team?
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.
- A new cancel connection example would be best
- At least one unit test would be great here
@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
.
k, thanks!