diff --git a/src/store/workflowStore.ts b/src/store/workflowStore.ts index 4c630e5b..04cc6d33 100644 --- a/src/store/workflowStore.ts +++ b/src/store/workflowStore.ts @@ -2415,7 +2415,7 @@ export const useWorkflowStore = create((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((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