diff --git a/.changeset/gorgeous-hats-count.md b/.changeset/gorgeous-hats-count.md new file mode 100644 index 00000000..ce00df81 --- /dev/null +++ b/.changeset/gorgeous-hats-count.md @@ -0,0 +1,5 @@ +--- +'@xyflow/react': patch +--- + +Improve TSDoc comments for `useEdges`, `useInternalNode`, `useNodes` and `useNodeId` hooks diff --git a/packages/react/src/contexts/NodeIdContext.ts b/packages/react/src/contexts/NodeIdContext.ts index 5458c98c..4fdef045 100644 --- a/packages/react/src/contexts/NodeIdContext.ts +++ b/packages/react/src/contexts/NodeIdContext.ts @@ -10,7 +10,7 @@ export const Consumer = NodeIdContext.Consumer; * drill down the id as a prop. * * @public - * @returns id of the node + * @returns The id for a node in the flow. * * @example *```jsx diff --git a/packages/react/src/hooks/useEdges.ts b/packages/react/src/hooks/useEdges.ts index 45263849..46db9939 100644 --- a/packages/react/src/hooks/useEdges.ts +++ b/packages/react/src/hooks/useEdges.ts @@ -10,7 +10,7 @@ const edgesSelector = (state: ReactFlowState) => state.edges; * will re-render **whenever any edge changes**. * * @public - * @returns An array of edges + * @returns An array of all edges currently in the flow. * * @example * ```tsx diff --git a/packages/react/src/hooks/useInternalNode.ts b/packages/react/src/hooks/useInternalNode.ts index ecd83897..a4678aaa 100644 --- a/packages/react/src/hooks/useInternalNode.ts +++ b/packages/react/src/hooks/useInternalNode.ts @@ -10,8 +10,8 @@ import type { InternalNode, Node } from '../types'; * including when a node is selected or moved. * * @public - * @param id - id of the node - * @returns array with visible node ids + * @param id - The ID of a node you want to observe. + * @returns The `InternalNode` object for the node with the given ID. * * @example * ```tsx diff --git a/packages/react/src/hooks/useNodes.ts b/packages/react/src/hooks/useNodes.ts index 9fa14bcb..6166327d 100644 --- a/packages/react/src/hooks/useNodes.ts +++ b/packages/react/src/hooks/useNodes.ts @@ -11,7 +11,7 @@ const nodesSelector = (state: ReactFlowState) => state.nodes; * or moved. * * @public - * @returns An array of nodes + * @returns An array of all nodes currently in the flow. * * @example * ```jsx