feat(table): column drag-and-drop reorder#3738
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Updates table rendering and selection logic to use Written by Cursor Bugbot for commit 12ced58. Configure here. |
Greptile SummaryThis PR adds native HTML5 drag-and-drop column reordering to the table component. A Key changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant TH as ColumnHeaderMenu (th)
participant Table as Table (parent)
participant API as /api/table/[id]/metadata
User->>TH: dragstart
TH->>Table: onDragStart(columnName)
Table->>Table: setDragColumnName(columnName)
User->>TH: dragover (hover target column)
TH->>TH: compute side (left/right) from clientX
TH->>Table: onDragOver(targetName, side)
Table->>Table: setDropTargetColumnName / setDropSide
TH-->>User: show drop indicator (2px line)
User->>TH: drop (release)
TH->>TH: handleDrop (e.preventDefault only)
User->>TH: dragend (fires on source)
TH->>Table: onDragEnd()
Table->>Table: compute newOrder from columnOrderRef / displayColumns
Table->>Table: setColumnOrder(newOrder)
Table->>API: PUT metadata {columnWidths, columnOrder}
API-->>Table: { success: true }
Table->>Table: setDragColumnName(null) / setDropTargetColumnName(null)
Reviews (4): Last reviewed commit: "fix(table): prevent stale refs during co..." | Re-trigger Greptile |
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx
Show resolved
Hide resolved
|
@cursor review |
|
@greptile |
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx
Outdated
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx
Outdated
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx
Outdated
Show resolved
Hide resolved
|
@greptile |
|
@cursor review |
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx
Show resolved
Hide resolved
Fix two bugs in column drag-and-drop: 1. Stale columnWidths ref during rename - compute updated widths inline before passing to updateMetadata 2. Escape-cancelled drag still reorders - update dropTargetColumnNameRef directly in handleColumnDragLeave to prevent handleColumnDragEnd from reading stale ref value Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx
Show resolved
Hide resolved
When the anchor column isn't in columnOrder, add it first then insert the new column relative to it, so 'right' insertions appear after the anchor as expected. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(table): column drag-and-drop reorder * fix(table): remove duplicate onDragEnd call from handleDrop * fix(table): persist columnOrder on rename/delete and defer delete to onSuccess * fix(table): prevent stale refs during column drag operations Fix two bugs in column drag-and-drop: 1. Stale columnWidths ref during rename - compute updated widths inline before passing to updateMetadata 2. Escape-cancelled drag still reorders - update dropTargetColumnNameRef directly in handleColumnDragLeave to prevent handleColumnDragEnd from reading stale ref value Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(table): insert column at correct side when anchor is unordered When the anchor column isn't in columnOrder, add it first then insert the new column relative to it, so 'right' insertions appear after the anchor as expected. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

Summary
Type of Change
Testing
Tested manually
Checklist