Skip to content

useHandleConnection appears not to be working #1413

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

You must be logged in to vote
  1. Never use a composable in a callback, that is bad practice.
    Composables are supposed to be called in the setup body of a component (same as React Hooks).
    Instead of what you're doing just use getConnectedEdges to receive all edges that are connected to a node.
    Afterwards you can still filter edges by direction if you need to.
const { getConnectedEdges } = useVueFlow()

function handleSomething() {
	for (const node of nodes) {
		const connectedEdges = getConnectedEdges(node.id)
		
		// now you can filter your edges by direction if you need to
	}
}
  1. You are trying to pass a specific handle id to the composable but I am pretty sure you never specified any id on the handle, thus the relevan…

Replies: 1 comment 2 replies

Comment options

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

@bcakmakoglu
Comment options

Answer selected by hortegaalcalde
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