From 0e8cecc59ced06a9f099109c4d3f58848b162bfc Mon Sep 17 00:00:00 2001 From: shrimbly Date: Fri, 20 Feb 2026 22:40:06 +1300 Subject: [PATCH] fix: embed directoryPath in workflow JSON for portable image hydration When importing a workflow via file picker, loadWorkflow had no way to find the image files on disk because directoryPath was only stored in localStorage (which doesn't survive browser switches or clears). Now auto-save embeds directoryPath in the workflow JSON, and loadWorkflow uses it as a fallback after the workflowPath parameter and localStorage config. Co-Authored-By: Claude Opus 4.6 --- src/store/workflowStore.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/store/workflowStore.ts b/src/store/workflowStore.ts index e239a17c..0c3c946d 100644 --- a/src/store/workflowStore.ts +++ b/src/store/workflowStore.ts @@ -102,6 +102,7 @@ export interface WorkflowFile { version: 1; id?: string; // Optional for backward compatibility with old/shared workflows name: string; + directoryPath?: string; // Embedded save path so image hydration works on import nodes: WorkflowNode[]; edges: WorkflowEdge[]; edgeStyle: EdgeStyle; @@ -1470,8 +1471,8 @@ export const useWorkflowStore = create((set, get) => ({ const configs = loadSaveConfigs(); const savedConfig = workflow.id ? configs[workflow.id] : null; - // Determine the workflow directory path (passed in or from saved config) - const directoryPath = workflowPath || savedConfig?.directoryPath; + // Determine the workflow directory path (passed in, from saved config, or embedded in workflow) + const directoryPath = workflowPath || savedConfig?.directoryPath || workflow.directoryPath; // Hydrate images if we have a directory path and the workflow has image refs let hydratedWorkflow = workflow; @@ -1666,6 +1667,7 @@ export const useWorkflowStore = create((set, get) => ({ version: 1, id: workflowId, name: workflowName, + directoryPath: saveDirectoryPath, nodes: currentNodes, edges, edgeStyle,