Reference
useHandleConnections()

useHandleConnections

Source on GitHub (opens in a new tab)

This hook can be used to get notified when the connections of a handle change.

<script lang="ts">
  import { useHandleConnections } from '@xyflow/svelte';
 
  const connections = useHandleConnections({ nodeId: 'node-id', type: 'target' });
 
  $: {
    // This will be called whenever connections change
    // for the target handle in the node with id 'node-id'
    console.log($connections);
  }
</script>

Signature

#Params
#nodeId
string
#type
"source" | "target"
The type of the handle
#id(optional)
string
The id of the handle. This is only necessary if you have multiple handles of the same type.
#Returns
A readable store of the connections that are connected to this handle.

Notes