Browse Source

fix(33): guard against undefined groups in save operations

Add defensive check before Object.keys(groups) in saveToFile and
exportWorkflow to prevent "Cannot read properties of undefined
(reading 'length')" when groups is undefined after AI workflow
generation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
handoff-20260429-1057
shrimbly 6 months ago
parent
commit
79045b8c09
  1. 4
      src/store/workflowStore.ts

4
src/store/workflowStore.ts

@ -2415,7 +2415,7 @@ export const useWorkflowStore = create<WorkflowStore>((set, get) => ({
nodes: nodes.map(({ selected, ...rest }) => rest),
edges,
edgeStyle,
groups: Object.keys(groups).length > 0 ? groups : undefined,
groups: groups && Object.keys(groups).length > 0 ? groups : undefined,
};
const json = JSON.stringify(workflow, null, 2);
@ -2675,7 +2675,7 @@ export const useWorkflowStore = create<WorkflowStore>((set, get) => ({
nodes: currentNodes,
edges,
edgeStyle,
groups: Object.keys(groups).length > 0 ? groups : undefined,
groups: groups && Object.keys(groups).length > 0 ? groups : undefined,
};
// If external image storage is enabled, externalize images before saving

Loading…
Cancel
Save