Skip to content

prevent nodes multiple connections #370

Answered by bcakmakoglu
Milad0071 asked this question in Q&A
Discussion options

You must be logged in to vote

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 or single.
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" />

Replies: 3 comments 12 replies

Comment options

You must be logged in to vote
1 reply
@Milad0071
Comment options

Answer selected by Milad0071
Comment options

You must be logged in to vote
9 replies
@Milad0071
Comment options

@bcakmakoglu
Comment options

@bcakmakoglu
Comment options

@Milad0071
Comment options

@Milad0071
Comment options

Comment options

You must be logged in to vote
2 replies
@bcakmakoglu
Comment options

@Milad0071
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants