Browse Source

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 <noreply@anthropic.com>
handoff-20260429-1057
shrimbly 5 months ago
parent
commit
2a0db1bcb7
  1. 10
      src/components/WorkflowCanvas.tsx

10
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,

Loading…
Cancel
Save