Files
pepperplus-ui/src/pages/VisProgPage/visualProgrammingUI/components/CustomNodeHandles.tsx
2026-01-06 15:12:00 +00:00

30 lines
551 B
TypeScript

import {
Handle,
useNodeConnections,
type HandleType,
type Position
} from '@xyflow/react';
const LimitedConnectionCountHandle = (props: {
node_id: string,
type: HandleType,
position: Position,
connection_count: number,
id?: string
}) => {
const connections = useNodeConnections({
id: props.node_id,
handleType: props.type,
handleId: props.id,
});
return (
<Handle
{...props}
isConnectable={connections.length < props.connection_count}
/>
);
};
export default LimitedConnectionCountHandle;