Skip to content

feat(tables): saved views with filter, sort, and column presets - #5961

Merged
TheodoreSpeaks merged 48 commits into
stagingfrom
feat/table-views
Jul 29, 2026
Merged

feat(tables): saved views with filter, sort, and column presets#5961
TheodoreSpeaks merged 48 commits into
stagingfrom
feat/table-views

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • Saved views on tables: name a filter + sort + column-visibility preset, switch between them from a View dropdown in the options bar
  • New Columns menu to show/hide columns, with workflow outputs nested under their group (hiding all of a group's children drops its spanning header)
  • Save button appears only when the current state diverges from the active view — ad-hoc filtering stays throwaway
  • Backed by a new table_views table; "All" is the absence of a view, so no backfill and the table is always reachable unfiltered
  • Gated behind the table-views feature flag (UI only — routes and migration ship ungated so a view saved during rollout survives the flag being turned off)

Type of Change

  • New feature

Testing

Tested manually. bun run type-check, bun run lint, all 11 CI audits, and check:migrations origin/staging pass. 29 unit tests across the views service, API contracts, and feature flags.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 29, 2026 6:39pm

Request Review

@cursor

cursor Bot commented Jul 25, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches core table grid persistence, URL state, and undo across view switches; routes ship ungated (UI-only flag) so data can be written if called directly.

Overview
Adds saved table views — named presets for filter, sort, column visibility, and layout (widths, order, pins) — plus API routes, a table_views migration, and a UI gated by the table-views feature flag (resolved server-side for full-page and mothership-embedded tables).

The table options bar gains a Views switcher, Columns show/hide menu (including workflow groups), and a Save / Save as view chip when live state diverges from the stored view. Active view is reflected in the URL (table-view, with an explicit All sentinel). Layout auto-saves into the active view via server-side configPatch merge; undo/redo stamps and prunes layout actions per view.

Also bumps the CI Build App job timeout from 15 to 25 minutes.

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

Comment thread apps/sim/hooks/queries/tables.ts
Comment thread apps/sim/lib/table/views/service.ts
Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
@greptile-apps

greptile-apps Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds feature-flagged saved table views with persisted filter, sort, visibility, and column-layout presets.

  • Adds authenticated view CRUD routes, validation contracts, persistence services, schema, and migration.
  • Adds view and column menus, view creation and rename flows, layout-aware grid persistence, and view-scoped undo handling.
  • Threads the table-views feature flag through standalone and embedded table surfaces.

Confidence Score: 3/5

The PR is not yet safe to merge because completing an in-progress layout gesture after switching views can still resolve persistence against the destination view.

The current grid binds the layout owner when a gesture completes rather than when it begins, leaving the previously reported cross-view persistence race reachable for resize, reorder, and pin interactions.

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

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx Coordinates saved-view selection, creation, explicit saves, and view-owned layout persistence.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx Adds view-specific layout seeding, persistence routing, hidden-column rendering, and layout snapshot support.
apps/sim/hooks/use-table-undo.ts Associates layout-bearing undo operations with their originating view and guards asynchronous layout application.
apps/sim/lib/table/views/service.ts Implements validated saved-view persistence and patch-based configuration updates.
packages/db/migrations/0275_table_views.sql Introduces the table_views persistence schema and supporting constraints.

Sequence Diagram

sequenceDiagram
  participant User
  participant Table as Table UI
  participant Grid as Table Grid
  participant API as View API
  participant DB as table_views
  User->>Table: Select or create saved view
  Table->>API: Load/create view config
  API->>DB: Read/write config
  DB-->>API: Saved view
  API-->>Table: Filter, sort, visibility, layout
  Table->>Grid: Apply active view config
  User->>Grid: Change column layout
  Grid->>Table: Persist layout patch with owner
  Table->>API: PATCH configPatch
  API->>DB: Merge layout fields
Loading

Reviews (34): Last reviewed commit: "merge: staging into feat/table-views; gr..." | Re-trigger Greptile

Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx Outdated
Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx Outdated
Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b49a061. Configure here.

Route-count baseline conflict: staging moved to 984 on its own; merged truth
with this branch's 2 view routes is 986, confirmed by running the audit.
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
…ey-scope the load flush

Merge housekeeping: table_views migration renumbered 0273 -> 0274 (staging
shipped 0273_copilot_tool_permission_decision); route baseline 986 -> 992,
confirmed by running the audit.

Two review fixes on top:

handlePersistLayout routed by activeView, which derives from the URL and lags
a render after the resolve effect stamps an adopted or just-created view — a
write in that gap fell through to shared metadata. It now routes by
seededViewIdRef, the owner record itself, stamped synchronously. This also
sends layout for a just-created view to that view before the list refetch
resolves it.

The load-window flush persisted a full readLayout() snapshot, carrying keys
the user never touched (pins still unseeded while the slower detail query
loads) over stored metadata. The buffer now records which KEYS were touched;
values are still read live at flush, but only touched keys are written.
@gitguardian

gitguardian Bot commented Jul 29, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
35187658 Triggered Username Password c6acc62 apps/desktop/src/main/browser-credentials/vault.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c6acc62. Configure here.

table_views migration renumbered 0274 -> 0275; staging shipped its own 0274
(file_folder_cutover_reconcile). Regenerated via drizzle-kit, chain verified.
Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx Outdated
Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
…their owner

Merge resolves the route baseline (staging dropped to 991; merged truth 993,
confirmed by audit).

Review fixes: routing layout by seededViewIdRef broke three ways, all because
the ref updates in a PARENT effect while the grid writes from CHILD effects
that run first. The grid now stamps every persist call with the owner it was
displaying (viewLayoutKey at write time; async paths already capture at
dispatch), so routing is independent of effect ordering:

- A view switch's seed reconcile no longer lands on the outgoing owner — the
  write carries the incoming key.
- A deep-linked view's first-load reconcile persists immediately instead of
  being buffered and dropped by adoption — an owner-stamped write is fully
  addressed regardless of resolve state.
- The terminal views-error path no longer stamps seededViewIdRef, so a later
  successful refetch still runs first-resolve adoption (with localWork keep);
  a new ownerResolvedRef marks settle for the All-buffer instead.

A create race now also ends on any navigation away, so a reconcile on the
destination can't fall back to the still-pending created id.
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 7b1af41. Configure here.

The build outgrew the 15-minute cap over the last two days of merges:
10m02 (c6acc62), then 14m44 after the folders/desktop/library batch
(adc557a, 16s under the limit), then two consecutive timeouts on
7b1af41 after the outlook merge. Staging's own latest runs show the same
signature (one cancelled). GitHub labels a job timeout "cancelled", which is
why these read as cancellations.
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