Skip to content

Commit 5460850

Browse files
fix(tables): "X running" badge counts actual in-flight cells, not dispatch scope
The badge derived from `runningCellCount` (the dispatch-scope estimate = rows-ahead × groupCount), which over-counts groups that already finished on rows still inside a dispatch's scope — a cascade where 3 of 4 workflow columns completed read "4 running" instead of "1". Derive `totalRunning` from the live `runningByRowId` map instead (the same per-row source the gutter and action-bar selection already sum), so it reflects cells actually in flight and updates per-cell via SSE rather than only on dispatch-window events. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5846d2a commit 5460850

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,13 @@ export function TableGrid({
323323

324324
const { data: tableRunState } = useTableRunState(tableId)
325325
const activeDispatches = tableRunState?.dispatches
326-
const totalRunning = tableRunState?.runningCellCount ?? 0
327326
const runningByRowId = tableRunState?.runningByRowId ?? EMPTY_RUNNING_BY_ROW
327+
// Actual in-flight cell count = sum of the live per-row map (kept current by
328+
// applyCell's SSE deltas, and the same source the per-row gutter uses). The
329+
// dispatch-scope `runningCellCount` over-counts already-completed groups on
330+
// rows still inside a dispatch's scope — e.g. a cascade where 3 of 4 columns
331+
// finished would read "4 running" instead of "1".
332+
const totalRunning = Object.values(runningByRowId).reduce((sum, n) => sum + n, 0)
328333

329334
const tableRowCountRef = useRef(tableData?.rowCount ?? 0)
330335
tableRowCountRef.current = tableData?.rowCount ?? 0

0 commit comments

Comments
 (0)