Skip to content

Commit 61343a1

Browse files
fix(enrichments): address second-pass PR review
- updateWorkflowGroup output diff now keys on outputId (falling back to blockId::path) so enrichment outputs — which share empty blockId/path — no longer collapse to one key and drop sibling columns. - Enrichment terminal write now clears output columns absent from the result, so a partial/empty re-run doesn't leave stale values. - Editing a group whose enrichment was removed from the registry shows an explanatory panel instead of silently falling through to the new-enrichment catalog.
1 parent fb6bbd0 commit 61343a1

3 files changed

Lines changed: 37 additions & 2 deletions

File tree

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/enrichments-sidebar/enrichments-sidebar.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,32 @@ function EnrichmentsSidebarBody({
6868
/>
6969
)
7070
}
71+
// Editing a group whose enrichment was removed from the registry — surface it
72+
// rather than silently dropping into the "new enrichment" catalog.
73+
if (editGroup && !editEnrichment) {
74+
return (
75+
<div className='flex h-full flex-col'>
76+
<div className='flex items-center justify-between border-[var(--border)] border-b px-3 py-[8.5px]'>
77+
<h2 className='font-medium text-[var(--text-primary)] text-small'>Enrichment</h2>
78+
<Button
79+
variant='ghost'
80+
size='sm'
81+
onClick={onClose}
82+
className='!p-1 size-7 flex-none'
83+
aria-label='Close'
84+
>
85+
<X className='size-[14px]' />
86+
</Button>
87+
</div>
88+
<div className='flex flex-1 items-center justify-center px-6 text-center'>
89+
<p className='text-[var(--text-tertiary)] text-small'>
90+
This enrichment ("{editGroup.enrichmentId}") is no longer available. Delete the column
91+
and add a current enrichment.
92+
</p>
93+
</div>
94+
</div>
95+
)
96+
}
7197

7298
if (selected) {
7399
return (

apps/sim/background/workflow-column-execution.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,15 @@ async function runWorkflowAndWriteTerminal(
254254
}
255255
}
256256

257+
// Write every output column: the result value when present, else clear
258+
// it. A partial/empty result must blank the columns it didn't fill so a
259+
// re-run that finds less than before doesn't leave stale values.
257260
const dataPatch: RowData = {}
258261
for (const out of group.outputs) {
259262
if (!out.outputId) continue
260263
const value = result[out.outputId]
261-
if (value !== undefined) dataPatch[out.columnName] = value as RowData[string]
264+
dataPatch[out.columnName] =
265+
value === undefined || value === null ? '' : (value as RowData[string])
262266
}
263267
await writeState(
264268
{ status: 'completed', executionId, jobId: null, workflowId: statusId, error: null },

apps/sim/lib/table/service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3293,7 +3293,12 @@ export async function updateWorkflowGroup(
32933293
// If the caller passed `outputs`, that's the new full set. If only
32943294
// `mappingUpdates` was sent, the new set is the remapped old set.
32953295
const newOutputs = data.outputs ?? oldOutputs
3296-
const oldKey = (o: WorkflowGroupOutput) => `${o.blockId}::${o.path}`
3296+
// Enrichment outputs all share empty `blockId`/`path`, so keying on those
3297+
// alone collapses every sibling to one entry (dropping columns on diff). Key
3298+
// on the registry `outputId` when present; fall back to `blockId::path` for
3299+
// workflow outputs.
3300+
const oldKey = (o: WorkflowGroupOutput) =>
3301+
o.outputId ? `out::${o.outputId}` : `${o.blockId}::${o.path}`
32973302
const oldByKey = new Map(oldOutputs.map((o) => [oldKey(o), o]))
32983303
const newByKey = new Map(newOutputs.map((o) => [oldKey(o), o]))
32993304

0 commit comments

Comments
 (0)