deprecated useHandleConnections

This commit is contained in:
peterkogo
2025-01-07 10:29:22 +01:00
parent 0863554271
commit 4a0b5e6c21
2 changed files with 10 additions and 0 deletions
@@ -22,6 +22,7 @@ type useHandleConnectionsParams = {
* Hook to check if a <Handle /> is connected to another <Handle /> and get the connections.
*
* @public
* @deprecated Use `useNodeConnections` instead.
* @param param.type - handle type 'source' or 'target'
* @param param.nodeId - node id - if not provided, the node id from the NodeIdContext is used
* @param param.id - the handle id (this is only needed if the node has multiple handles of the same type)
@@ -36,6 +37,10 @@ export function useHandleConnections({
onConnect,
onDisconnect,
}: useHandleConnectionsParams): HandleConnection[] {
console.warn(
'[DEPRECATED] `useHandleConnections` is deprecated. Instead use `useNodeConnections` https://reactflow.dev/api-reference/hooks/useNodeConnections'
);
const _nodeId = useNodeId();
const currentNodeId = nodeId ?? _nodeId;
@@ -16,6 +16,7 @@ const initialConnections: HandleConnection[] = [];
* Hook to check if a <Handle /> is connected to another <Handle /> and get the connections.
*
* @public
* @deprecated Use `useNodeConnections` instead.
* @param param.nodeId
* @param param.type - handle type 'source' or 'target'
* @param param.id - the handle id (this is only needed if the node has multiple handles of the same type)
@@ -24,6 +25,10 @@ const initialConnections: HandleConnection[] = [];
export function useHandleConnections({ type, nodeId, id = null }: useHandleConnectionsParams) {
const { edges, connectionLookup } = useStore();
console.warn(
'[DEPRECATED] `useHandleConnections` is deprecated. Instead use `useNodeConnections` https://svelteflow.dev/api-reference/hooks/useNodeConnections'
);
const _nodeId = getContext<string>('svelteflow__node_id');
const currentNodeId = nodeId ?? _nodeId;