feat(tables): add reference columns - #7105
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds Reference table columns across contracts, persistence, conversion, Copilot tooling, undo metadata, and the table editor. It also adds row-ID copying and revises column-header selection, configuration, and inline rename behavior.
Confidence Score: 3/5The PR should not merge until reference-target archival is coordinated and failed inline renames stop leaving invalid undo history. A referenced table can be archived after validation, leaving persisted navigation to an inaccessible target, and a rejected rename retains an undo action despite the mutation rollback. Files Needing Attention: apps/sim/lib/table/column-types/registry.server.ts, apps/sim/lib/table/service.ts, apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx
|
| Filename | Overview |
|---|---|
| apps/sim/lib/table/column-types/registry.server.ts | Adds active same-workspace target validation, but the resulting invariant is not maintained when a referenced target is archived. |
| apps/sim/lib/table/columns/service.ts | Adds Reference metadata validation and schema-only target updates with transactional persistence. |
| apps/sim/lib/table/orchestration/columns.ts | Routes Reference conversions and target-only updates through the appropriate typed mutation paths. |
| apps/sim/lib/api/contracts/tables.ts | Extends internal table contracts with bounded Reference target IDs and type-specific cross-field validation. |
| apps/sim/lib/api/contracts/v2/tables.ts | Adds Reference metadata to strict public create and update schemas. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx | Adds Reference navigation and inline rename behavior, but failed renames leave unapplied actions in undo history. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/column-config-sidebar/column-config-sidebar.tsx | Adds target-table selection for Reference columns and moves renaming out of the configuration sidebar. |
| apps/sim/hooks/use-table-undo.ts | Generalizes deleted-column restoration to preserve all registered type metadata. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Create or update Reference column] --> B[Validate active target in workspace]
B --> C[Persist referenceTableId]
C --> D[Render Reference column action]
D --> E[Navigate to target table]
C --> F[Target table archived]
F --> G[Source reference remains unchanged]
G --> H[Navigation cannot load archived target]
Reviews (1): Last reviewed commit: "improvement(tables): rename columns on d..." | Re-trigger Greptile
| and( | ||
| eq(userTableDefinitions.workspaceId, workspaceId), | ||
| inArray(userTableDefinitions.id, referencedTableIds), | ||
| isNull(userTableDefinitions.archivedAt) |
There was a problem hiding this comment.
| onSave: (columnName, newName) => { | ||
| const oldName = columnsRef.current.find((c) => c.key === columnName)?.name ?? columnName | ||
| pushUndoRef.current({ type: 'rename-column', oldName, newName, columnId: columnName }) |
There was a problem hiding this comment.
When the server rejects a column rename, this callback leaves the preemptively pushed rename-column action in history even though the optimistic cache update is rolled back, causing a later undo or redo to consume and replay a rename that never succeeded.
Knowledge Base Used: Web application and product surfaces
There was a problem hiding this comment.
No issues found across 42 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
Summary
Tables can now store row IDs in a Reference column configured against another table in the same workspace. The type is preserved through table contracts and write paths, while the grid provides sidebar configuration, row-ID copying, and direct navigation to the referenced table.
Stack
This is the foundation layer of the Reference-row stack. #7106 adds inline referenced-row inspection on top of it.
Type of Change
Testing
bun run type-checkbun run check:api-validationReviewers should focus on Reference metadata ownership, column conversion behavior, and the create/edit sidebar flow.
Checklist
Screenshots/Videos
Not attached. The create, configure, rename, copy-row-ID, and reference-navigation flows were exercised locally.
Post-Deploy Monitoring & Validation