From 2a0db1bcb764bac501bc15f08cf420e0e59c6947 Mon Sep 17 00:00:00 2001 From: shrimbly Date: Thu, 26 Feb 2026 06:02:18 +1300 Subject: [PATCH] fix(switch): resolve output handle type from inputType for connection drop menu Switch output handles use dynamic IDs (random strings) that getHandleType() can't resolve. Now falls back to the Switch node's inputType field so dragging from a Switch output shows the correct type-specific connection menu. Co-Authored-By: Claude Opus 4.6 --- src/components/WorkflowCanvas.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/WorkflowCanvas.tsx b/src/components/WorkflowCanvas.tsx index 3a91739a..ea3d636b 100644 --- a/src/components/WorkflowCanvas.tsx +++ b/src/components/WorkflowCanvas.tsx @@ -582,9 +582,17 @@ export function WorkflowCanvas() { const { clientX, clientY } = event as MouseEvent; const fromHandleId = connectionState.fromHandle?.id || null; - const fromHandleType = getHandleType(fromHandleId); // Use getHandleType for dynamic handles + let fromHandleType = getHandleType(fromHandleId); // Use getHandleType for dynamic handles const isFromSource = connectionState.fromHandle?.type === "source"; + // Switch output handles have dynamic IDs — resolve type from node's inputType + if (!fromHandleType && connectionState.fromNode.type === "switch") { + const switchData = connectionState.fromNode.data as { inputType?: string | null }; + if (switchData.inputType) { + fromHandleType = switchData.inputType as "image" | "text" | "video" | "audio" | "3d" | "easeCurve"; + } + } + // Helper to find a compatible handle on a node by type const findCompatibleHandle = ( node: Node,