Skip to content

feat(tables): filter by cell value from the cell menu, sort from the column menu - #6719

Merged
waleedlatif1 merged 3 commits into
stagingfrom
feat/table-filter-by-cell-value
Aug 15, 2026
Merged

feat(tables): filter by cell value from the cell menu, sort from the column menu#6719
waleedlatif1 merged 3 commits into
stagingfrom
feat/table-filter-by-cell-value

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Right-click a cell → Filter by cell value. Narrows the table to rows whose cell in that column reads the same, and opens the filter panel so the applied rule is visible and editable.
  • Right-click a column header (or use its chevron) → Sort ascending / Sort descending, plus Clear sort when that column owns the sort. The active direction is marked.
  • Conditions are built from the raw stored value, never round-tripped through text: a select's option id, a date's stored string, and a numeric-looking string cell all compare byte-exactly against what the write path stored.
  • Filtering twice on one column swaps the value instead of AND-ing two equalities into a guaranteed-empty result. Conditions on other columns are kept.
  • The item hides itself when a cell has no filter to offer — a json cell (the server rejects the containment operators on that type, and a rejected predicate would stick in state and fail every later refetch) or an operator the column type rejects.
  • Also fixes a pre-existing gap: switching views with the filter panel open left the panel showing the outgoing view's rules. Both external filter writes now re-seed it.

Type of Change

  • New feature

Testing

  • Unit tests for the condition builder and the filter merge, covering every column type, empty cells, single vs multi select, and the json cases.
  • Round-tripped every column type through the real server path (validateStoragePredicatebuildPredicateClause) to confirm each predicate validates and compiles rather than 400-ing the rows query.
  • Typecheck, bun run lint:check, and bun run check:audits (26 audits) pass.
  • Not yet clicked through in a browser.

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 Aug 15, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 15, 2026 1:10am

Request Review

@cursor

cursor Bot commented Aug 15, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes how table row filters are composed and merged (including nested predicate groups), which directly affects which rows load; logic is covered by unit tests and explicit guards for json/invalid operators.

Overview
Adds Filter by cell value on the cell context menu: it builds filter conditions from the raw stored cell value (not display text), merges them into the active filter via withCellValueFilter (replacing same-column constraints instead of AND-ing duplicate equalities), and opens the filter panel so the rule is visible. The menu item only appears when cellValueFilterConditions can produce valid predicates; json cells and unsupported operators are excluded to avoid server-rejected filters sticking in state.

Adds Sort ascending / descending and Clear sort to the column header options menu, wired to the same URL sort params as the options bar, with the active direction highlighted on that column.

Fixes filter panel drift when the filter is set outside the panel (view switch or cell filter): replaceFilter bumps filterSeed so TableFilter remounts with the rules actually in effect.

Reviewed by Cursor Bugbot for commit 01df1ee. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds cell-value filtering from the cell context menu, column sorting controls in header menus, and filter-panel reseeding for externally replaced filters.

  • Builds type-aware predicates from raw stored cell values and merges them into the active filter.
  • Adds ascending, descending, and clear-sort actions to sortable column menus.
  • Re-seeds the filter panel after view changes and cell-menu filtering.
  • Adds focused unit coverage for predicate construction and replacement behavior.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/table/query-builder/cell-filter.ts Adds type-aware cell predicate construction and recursively replaces existing constraints on the selected column.
apps/sim/lib/table/query-builder/tests/cell-filter.test.ts Covers scalar, empty, select, multi-select, JSON, and nested predicate-merging behavior.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx Centralizes external filter replacement, filter-panel reseeding, and reusable sort handlers.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx Wires cell context filtering and active column-sort state into the grid menus.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/headers/workflow-group-meta-cell.tsx Adds ascending, descending, and clear-sort items to sortable column option menus.

Reviews (3): Last reviewed commit: "fix(tables): refuse cell-value filters o..." | Re-trigger Greptile

Comment thread apps/sim/lib/table/query-builder/cell-filter.ts
Comment thread apps/sim/lib/table/query-builder/cell-filter.ts Outdated
Comment thread apps/sim/lib/table/query-builder/cell-filter.ts Outdated
Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
Comment thread apps/sim/lib/table/query-builder/cell-filter.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

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!

2 issues from previous reviews remain unresolved.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit e079fa4. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

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 01df1ee. Configure here.

@waleedlatif1
waleedlatif1 merged commit 2a7abfd into staging Aug 15, 2026
24 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/table-filter-by-cell-value branch August 15, 2026 01:13
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