18 lines
384 B
JavaScript
18 lines
384 B
JavaScript
import React from 'react';
|
|
import { Handle, useNodeConnections } from '@xyflow/react';
|
|
|
|
const OnlyOneHandle = (props) => {
|
|
const connections = useNodeConnections({
|
|
handleType: props.type,
|
|
});
|
|
|
|
return (
|
|
<Handle
|
|
{...props}
|
|
isConnectable={connections.length < props.connectionCount}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default OnlyOneHandle;
|