Skip to content

Commit 9398a2b

Browse files
fix(table): include runningBlockIds + blockErrors in SSE event payload
The cell renderer's 'queued' vs 'running' vs 'pending-upstream' decision reads exec.runningBlockIds + exec.blockErrors. Without those fields the inFlight branch falls through to 'pending-upstream' (amber Pending pill) even when the worker has already written status=running. The worker writes both fields to DB; the SSE event was stripping them. Thread them through events.ts → cell-write.ts → use-table-event-stream.ts.
1 parent 52834e9 commit 9398a2b

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/hooks/use-table-event-stream.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function useTableEventStream({
7272
let reconnectAttempt = 0
7373

7474
const applyCell = (event: Extract<TableEvent, { kind: 'cell' }>): void => {
75-
const { rowId, groupId, status, executionId, jobId, error, outputs } = event
75+
const { rowId, groupId, status, executionId, jobId, error, outputs, runningBlockIds, blockErrors } = event
7676
void snapshotAndMutateRows(
7777
queryClient,
7878
tableId,
@@ -86,6 +86,8 @@ export function useTableEventStream({
8686
// Preserve workflowId from cache; SSE payload doesn't carry it.
8787
workflowId: prevExec?.workflowId ?? '',
8888
error: error ?? null,
89+
...(runningBlockIds ? { runningBlockIds } : {}),
90+
...(blockErrors ? { blockErrors } : {}),
8991
}
9092
const nextExecutions: RowExecutions = {
9193
...(row.executions ?? {}),

apps/sim/lib/table/cell-write.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ export async function writeWorkflowGroupState(
117117

118118
const dataPatch = payload.dataPatch
119119
const hasOutputs = dataPatch && Object.keys(dataPatch).length > 0
120+
const runningBlockIds = payload.executionState.runningBlockIds
121+
const blockErrors = payload.executionState.blockErrors
120122
void appendTableEvent({
121123
kind: 'cell',
122124
tableId,
@@ -127,6 +129,8 @@ export async function writeWorkflowGroupState(
127129
jobId: payload.executionState.jobId ?? null,
128130
error: payload.executionState.error ?? null,
129131
...(hasOutputs ? { outputs: dataPatch } : {}),
132+
...(runningBlockIds && runningBlockIds.length > 0 ? { runningBlockIds } : {}),
133+
...(blockErrors && Object.keys(blockErrors).length > 0 ? { blockErrors } : {}),
130134
})
131135

132136
return 'wrote'

apps/sim/lib/table/events.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ export interface TableEvent {
8989
* already has these in hand from the same updateRow call that wrote DB.
9090
*/
9191
outputs?: Record<string, unknown>
92+
/**
93+
* Block-level metadata the renderer reads to distinguish "running" (some
94+
* block actively executing) from "pending-upstream" (run started but this
95+
* column's block hasn't fired yet). The worker fills these on partial
96+
* writes; without them the cell stays on the amber Pending pill.
97+
*/
98+
runningBlockIds?: string[]
99+
blockErrors?: Record<string, string>
92100
}
93101

94102
export interface TableEventEntry {

0 commit comments

Comments
 (0)