From 1839b9031a0b6f5c15ffc7da77c11e8231459898 Mon Sep 17 00:00:00 2001 From: shrimbly Date: Fri, 20 Feb 2026 22:15:45 +1300 Subject: [PATCH] fix: migrate legacy indexed handle IDs on workflow load Saved workflows could contain edges targeting nanoBanana nodes with indexed handle IDs (image-0, text-0) from a previous schema-based handle format. GenerateImageNode now always renders non-indexed handles (image, text), causing React Flow error #008 on every interaction. Normalize these edge handles during loadWorkflow. Co-Authored-By: Claude Opus 4.6 --- src/store/workflowStore.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/store/workflowStore.ts b/src/store/workflowStore.ts index 45d9bf5d..c018b2b4 100644 --- a/src/store/workflowStore.ts +++ b/src/store/workflowStore.ts @@ -1437,6 +1437,26 @@ export const useWorkflowStore = create((set, get) => ({ return node; }) as WorkflowNode[]; + // Migrate legacy indexed handle IDs on edges targeting nanoBanana nodes. + // GenerateImageNode always renders "image"/"text" handles (not "image-0"/"text-0"), + // so edges saved with the old indexed format cause React Flow error #008. + const nanoBananaNodeIds = new Set( + workflow.nodes.filter((n) => n.type === "nanoBanana").map((n) => n.id) + ); + workflow.edges = workflow.edges.map((edge) => { + if (!nanoBananaNodeIds.has(edge.target)) return edge; + const th = edge.targetHandle; + if (th === "image-0" || th === "text-0") { + const baseHandle = th === "image-0" ? "image" : "text"; + return { + ...edge, + targetHandle: baseHandle, + id: `edge-${edge.source}-${edge.target}-${edge.sourceHandle || "default"}-${baseHandle}`, + }; + } + return edge; + }); + // Look up saved config from localStorage (only if workflow has an ID) const configs = loadSaveConfigs(); const savedConfig = workflow.id ? configs[workflow.id] : null;