prevent nodes multiple connections #370
-
hello i hope you are fine and well. how can i stop nodes from accepting or sending multiple edges or connection lines to other elements? i need every node to has only one connection line in the output handle. thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
There's a couple ways to go about that. If you're using custom nodes you can pass a Handles also accept a <Handle id="handle-right-a" connectable="single" /> |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
hello again my friend. how are you doing? I need your help again i would appreciate it if you have time. before migrating from 0.4.... version to 1.**** version i had this code: const center = computed(() => { |
Beta Was this translation helpful? Give feedback.
There's a couple ways to go about that.
If you're using custom nodes you can pass a
isValidConnection
function to your Handles.Check this example: https://vueflow.dev/examples/edges/validation.html
Handles also accept a
connectable
prop that you can set to either a boolean, a callback fn orsingle
.single
should be the mode you're looking for, i.e. the Handle will stop allowing connections if there is at least 1 connection already.<Handle id="handle-right-a" connectable="single" />