Skip to content

fix(tables): resource-cell icons, embedded filters, run-state + UI fixes#4789

Merged
TheodoreSpeaks merged 4 commits into
stagingfrom
fix/table-workflow-stuff
May 29, 2026
Merged

fix(tables): resource-cell icons, embedded filters, run-state + UI fixes#4789
TheodoreSpeaks merged 4 commits into
stagingfrom
fix/table-workflow-stuff

Conversation

@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator

Table workspace fixes + a couple of small features, all scoped to the tables UI and the table run dispatcher.

Features

  • Sim-resource tagged cells — a string cell holding an in-workspace resource URL (/workspace/{id}/{w|tables|knowledge|files}/{id}) now renders as a tagged-resource chip (icon + name link), reusing ContextMentionIcon (the per-workflow colored square for workflows). Only the matching resource list is fetched; other-workspace / external URLs fall back to the existing favicon link.
  • Embedded mothership filters — Sort + Filter (and the run/stop control) are now shown in the embedded table resource view, wired to the same useTable query options as the full page.
  • Infinite-scroll spinner — a loading row renders while the next page loads instead of looking like the end of the table.

Fixes

  • Row-number overflow — reserve the full run/stop button area (30px) so wide row indices don't clip the sticky cell.
  • Row numbers right-aligned — number hugs the right of its box (no hover position jump), with a scaled right inset (2px ≤3 digits, 4px for 4+).
  • Single run/stop control — removed TableGrid's duplicate embedded run-status bar; it now lives only in the options bar, left-aligned next to Filter + Sort.
  • autoRun=false queued overlay — the dispatch overlay (resolveCellExec) no longer paints autoRun=false cells "Queued" for auto-fire dispatches (the dispatcher skips those per-cell); manual runs still show Queued.
  • Stuck "X running" badgecountRunningCells now excludes orphan pre-stamps (pending + executionId null), so the badge doesn't stick above zero when a run failed to enqueue / was orphaned. Verified against prod (tbl_3e51f6414…: 1 → 0).
  • "View execution" guard — the action bar's canViewExecution now requires a real executionId, so an error that never produced an execution (enqueue failure) doesn't offer "View execution" (context menu already gated on this).

Test notes

  • Resource cells: paste /workspace/{wsId}/w/{id}, .../tables/{id}, .../knowledge/{id}, .../files/{id} into string cells.
  • autoRun=false: add an autoRun-off column, then add a row / edit a dep column → its cells should stay empty (not Queued); a manual Run-all should still show Queued.

🤖 Generated with Claude Code

TheodoreSpeaks and others added 2 commits May 28, 2026 18:08
…d fixes

- table-grid: render in-workspace resource URLs (workflow/table/KB/file) as
  tagged-resource cells reusing ContextMentionIcon (colored square for
  workflows), matching @-mention chips; only the matching list is fetched.
- table-grid: fix row-number sticky cell overflow — reserve the full run/stop
  button area (30px, not 16px) so wide row indices don't clip.
- table-grid: show an infinite-scroll loading spinner while the next page
  loads instead of looking like the end of the table.
- table: surface sort + filter (and run/stop via the options-bar extras slot)
  in the embedded mothership table resource view.
- table-grid/utils: stop the dispatch overlay from optimistically painting
  autoRun=false cells Queued for auto-fire dispatches — the dispatcher skips
  those groups ('autoRun-off'); manual runs still show Queued (manual-bypass).
- dispatcher: exclude orphan pre-stamps (pending + executionId null) from
  countRunningCells so the "X running" badge doesn't stick above zero.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-execution guard

- table: de-duplicate the run/stop control in the embedded mothership view —
  drop TableGrid's own embedded run-status bar; it now lives only in the
  options bar (left-aligned next to Filter + Sort). Removes the orphaned
  RunStatusControl import + onStopAll/cancelRunsPending props.
- data-row: right-align the row number within its box (hugs the right edge,
  no hover position jump) with a scaled right inset — 2px for ≤3-digit
  indices, 4px for 4+ so narrow columns don't look over-padded.
- table-grid: require a real executionId in the action bar's canViewExecution
  flag so an error that never produced an execution (enqueue failure →
  status 'error', executionId null) doesn't offer "View execution".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 29, 2026 6:31pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 29, 2026

PR Summary

Medium Risk
Changes table run counting and queued overlay logic plus dispatcher SQL filters; mostly UX-facing but can affect stop-all and badge accuracy if edge cases were missed.

Overview
String cells whose value is a same-workspace resource path (/workspace/.../w|tables|knowledge|files/...) now render as tagged-resource chips (mention icon + named in-app link) instead of generic external URLs; resolution flows through workspaceId on rows/cells and a new SimResourceCell that fetches only the matching resource list.

Embedded table view always shows Sort + Filter; the run/stop control lives in ResourceOptionsBar (not a second bar inside the grid). Infinite scroll shows a loading row while the next page loads. Row index gutter reserves full space for run/stop, right-aligns numbers, and tightens padding for narrow indices.

Run UX accuracy: global “running” count sums the live per-row map (not dispatch scope totals); Queued overlay skips autoRun=false cells on auto-fire dispatches; server countRunningCells ignores orphan pending rows with no executionId; View execution requires a real executionId.

Reviewed by Cursor Bugbot for commit 5460850. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 29, 2026

Greptile Summary

This PR delivers a set of table UI fixes and small features scoped entirely to the tables workspace and the table run dispatcher. The main additions are sim-resource tagged cells (URLs pointing to in-workspace resources now render as chips), embedded sort/filter controls for mothership mode, and an infinite-scroll loading spinner.

  • Bug fixes: orphan pre-stamp countRunningCells query, canViewExecution guard requiring a real executionId, and the resolveCellExec overlay no longer painting autoRun=false cells Queued on auto-fire dispatches.
  • Layout fixes: checkbox column width now reserves 30 px for the run/stop button area (up from 16 px), and the row-number label is right-aligned.
  • New resource cell: extractSimResourceInfo + SimResourceCell render in-workspace URLs as icon+name chips, fetching only the matching resource list via an enabled guard on each query.

Confidence Score: 5/5

Safe to merge — all changes are contained to the tables UI and the run dispatcher; no data-path regressions found.

Each fix targets a specific, verified defect (orphan pre-stamp over-count in the DB query, autoRun=false optimistic overlay, canViewExecution without a real executionId, cascade badge over-count) and the logic is consistent with the surrounding code. The new SimResourceCell feature is well-guarded (same-workspace check, single enabled query, graceful fallback label). The isFetchingNextPage spinner is correctly placed outside the virtualizer row loop. No untested codepaths or missing guards were found.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/sim-resource-cell.tsx New component: renders a tagged-resource chip for in-workspace URL cells; hooks are always called but only one is enabled at a time, consistent with React hooks rules.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/cell-render.tsx Adds sim-resource kind to the CellRenderKind discriminated union and the extractSimResourceInfo parser; regex and URL handling look correct.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx Removes duplicate embedded run-status bar, switches totalRunning to sum(runningByRowId) to fix cascade over-count, adds isFetchingNextPage spinner placed correctly outside the virtualizer loop, and guards canViewExecution on a real executionId.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/utils.ts checkboxColLayout now reserves 30px for the run/stop button; resolveCellExec skips autoRun=false groups on auto-fire dispatches correctly.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx ResourceOptionsBar moved outside the !embedded block; run/stop control now in the extras slot for embedded mode; onStopAll/cancelRunsPending props removed from TableGrid correctly.
apps/sim/lib/table/dispatcher.ts countRunningCells now excludes orphan pending pre-stamps (pending + null executionId) via a correct De Morgan NOT condition; drizzle-orm or/ne/isNotNull imports added cleanly.
apps/sim/hooks/queries/workspace-files.ts useWorkspaceFiles gains an optional enabled flag consistent with how other resource query hooks are gated.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/data-row.tsx workspaceId prop threaded through; memoization comparator updated accordingly; row-number alignment changed to right-justified.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/cell-content.tsx workspaceId prop added and forwarded to resolveCellRender; minimal change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Cell value: string] --> B{currentWorkspaceId provided?}
    B -- No --> E[extractUrlInfo]
    B -- Yes --> C[extractSimResourceInfo]
    C --> D{Matches /workspace/wsId/section/resourceId?}
    D -- No --> E
    D -- Yes --> F{workspaceId == currentWorkspaceId?}
    F -- No --> E
    F -- Yes --> G[kind: sim-resource]
    E --> H{Valid URL?}
    H -- Yes --> I[kind: url]
    H -- No --> J[kind: text]
    G --> K[SimResourceCell renders chip]
    K --> L{resourceType?}
    L -- workflow --> M[useWorkflows enabled]
    L -- table --> N[useTablesList enabled]
    L -- knowledge --> O[useKnowledgeBasesQuery enabled]
    L -- file --> P[useWorkspaceFiles enabled]
    M & N & O & P --> Q[Resolve name from matching list]
    Q --> R[ContextMentionIcon + href link]
Loading

Reviews (2): Last reviewed commit: "fix(tables): "X running" badge counts ac..." | Re-trigger Greptile

Comment thread apps/sim/lib/table/dispatcher.ts Outdated
…abled flag for files query

- dispatcher: replace the `not(and(...)) as SQL` cast in countRunningCells with
  `or(ne(status,'pending'), isNotNull(executionId))` — De Morgan equivalent,
  fully type-checked, no cast and no hand-written raw SQL.
- workspace-files: add an `enabled` option to useWorkspaceFiles; sim-resource
  cell now passes the real workspaceId with `enabled` instead of '' so the
  query cache isn't polluted with an empty-key entry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…patch 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>
@TheodoreSpeaks
Copy link
Copy Markdown
Collaborator Author

@greptile review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant