Skip to content

Commit 14a9005

Browse files
committed
Move IO Node Handles into Node Manager
1 parent fb3db51 commit 14a9005

File tree

1 file changed

+11
-8
lines changed
  • src/components/shared/ReactFlow/FlowCanvas/IONode

1 file changed

+11
-8
lines changed

src/components/shared/ReactFlow/FlowCanvas/IONode/IONode.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface IONodeProps {
2727
}
2828

2929
const IONode = ({ type, data, selected = false }: IONodeProps) => {
30-
const { getInputNodeId, getOutputNodeId } = useNodeManager();
30+
const { getNodeId, getHandleNodeId } = useNodeManager();
3131
const { graphSpec, componentSpec } = useComponentSpec();
3232
const { setContent, clearContent } = useContextPanel();
3333

@@ -58,21 +58,24 @@ const IONode = ({ type, data, selected = false }: IONodeProps) => {
5858
[componentSpec.outputs, spec.name],
5959
);
6060

61-
const nodeId = isInput
62-
? getInputNodeId(inputNameToInputId(spec.name))
63-
: getOutputNodeId(outputNameToOutputId(spec.name));
61+
const inputId = inputNameToInputId(spec.name);
62+
const outputId = outputNameToOutputId(spec.name);
63+
const id = isInput ? inputId : outputId;
6464

65-
const nodeHandleId = `${nodeId}_handle`;
65+
const nodeId = getNodeId(id, type);
66+
67+
const handleNodeType = isInput ? "outputHandle" : "inputHandle";
68+
const nodeHandleId = getHandleNodeId(id, "handle", handleNodeType);
6669

6770
const handleHandleClick = useCallback(() => {
6871
if (ENABLE_DEBUG_MODE) {
69-
console.log(`${isInput ? "Input" : "Output"} Node Handle clicked:`, {
70-
name: isInput ? input?.name : output?.name,
72+
console.log(`${type} Node Handle clicked:`, {
73+
name: spec.name,
7174
nodeId,
7275
handleId: nodeHandleId,
7376
});
7477
}
75-
}, [isInput, input, output, nodeId, nodeHandleId]);
78+
}, [spec, nodeId, nodeHandleId]);
7679

7780
useEffect(() => {
7881
if (selected) {

0 commit comments

Comments
 (0)