Skip to content

Commit 8706cca

Browse files
fix(table): strip sibling deps when removing workflow output via updateWorkflowGroup
deleteWorkflowGroup already stripped removed-column deps from sibling groups, but updateWorkflowGroup (the path the UI takes when deleting one output of a multi-output group) didn't — schema validation then rejected the update with 'Group X depends on missing column Y'.
1 parent b21c4df commit 8706cca

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

apps/sim/lib/table/service.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2979,7 +2979,21 @@ export async function updateWorkflowGroup(
29792979
outputs: newOutputs,
29802980
...(data.autoRun !== undefined ? { autoRun: data.autoRun } : {}),
29812981
}
2982-
const nextGroups = groups.map((g, i) => (i === groupIndex ? updatedGroup : g))
2982+
// Removed outputs may be referenced as deps by sibling groups; strip those
2983+
// refs so we don't leave dangling-column deps that fail schema validation.
2984+
const nextGroups = groups
2985+
.map((g, i) => (i === groupIndex ? updatedGroup : g))
2986+
.map((g) => {
2987+
if (g.id === updatedGroup.id) return g
2988+
const filtered = g.dependencies?.columns?.filter((d) => !removedColumnNames.has(d))
2989+
if (!filtered || filtered.length === (g.dependencies?.columns?.length ?? 0)) return g
2990+
return {
2991+
...g,
2992+
...(filtered.length > 0
2993+
? { dependencies: { columns: filtered } }
2994+
: { dependencies: undefined }),
2995+
}
2996+
})
29832997
const updatedSchema: TableSchema = {
29842998
...schema,
29852999
columns: nextColumns,

0 commit comments

Comments
 (0)