Merge pull request #5160 from dimaMachina/tsdoc2-6
Improve TSDoc comments for `type UseHandleConnectionsParams` and `useHandleConnections` hook
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@xyflow/react': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Improve TSDoc comments for `type UseHandleConnectionsParams` and `useHandleConnections` hook
|
||||||
@@ -10,11 +10,16 @@ import {
|
|||||||
import { useStore } from './useStore';
|
import { useStore } from './useStore';
|
||||||
import { useNodeId } from '../contexts/NodeIdContext';
|
import { useNodeId } from '../contexts/NodeIdContext';
|
||||||
|
|
||||||
type useHandleConnectionsParams = {
|
type UseHandleConnectionsParams = {
|
||||||
|
/** What type of handle connections do you want to observe? */
|
||||||
type: HandleType;
|
type: HandleType;
|
||||||
|
/** The handle id (this is only needed if the node has multiple handles of the same type). */
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
|
/** If node id is not provided, the node id from the `NodeIdContext` is used. */
|
||||||
nodeId?: string;
|
nodeId?: string;
|
||||||
|
/** Gets called when a connection is established. */
|
||||||
onConnect?: (connections: Connection[]) => void;
|
onConnect?: (connections: Connection[]) => void;
|
||||||
|
/** Gets called when a connection is removed. */
|
||||||
onDisconnect?: (connections: Connection[]) => void;
|
onDisconnect?: (connections: Connection[]) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -23,12 +28,7 @@ type useHandleConnectionsParams = {
|
|||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
* @deprecated Use `useNodeConnections` instead.
|
* @deprecated Use `useNodeConnections` instead.
|
||||||
* @param param.type - handle type 'source' or 'target'
|
* @returns An array with handle connections.
|
||||||
* @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)
|
|
||||||
* @param param.onConnect - gets called when a connection is established
|
|
||||||
* @param param.onDisconnect - gets called when a connection is removed
|
|
||||||
* @returns an array with handle connections
|
|
||||||
*/
|
*/
|
||||||
export function useHandleConnections({
|
export function useHandleConnections({
|
||||||
type,
|
type,
|
||||||
@@ -36,7 +36,7 @@ export function useHandleConnections({
|
|||||||
nodeId,
|
nodeId,
|
||||||
onConnect,
|
onConnect,
|
||||||
onDisconnect,
|
onDisconnect,
|
||||||
}: useHandleConnectionsParams): HandleConnection[] {
|
}: UseHandleConnectionsParams): HandleConnection[] {
|
||||||
console.warn(
|
console.warn(
|
||||||
'[DEPRECATED] `useHandleConnections` is deprecated. Instead use `useNodeConnections` https://reactflow.dev/api-reference/hooks/useNodeConnections'
|
'[DEPRECATED] `useHandleConnections` is deprecated. Instead use `useNodeConnections` https://reactflow.dev/api-reference/hooks/useNodeConnections'
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user