fix(tables): optimistic updates for column delete/update#4512
fix(tables): optimistic updates for column delete/update#4512waleedlatif1 merged 2 commits intostagingfrom
Conversation
Add onMutate/onError to useDeleteColumn and useUpdateColumn so column deletes feel instant on large tables (no flash-back during the JSONB rewrite) and concurrent type changes don't race the in-flight delete's invalidation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit 39be514. Configure here. |
Greptile SummaryThis PR adds
Confidence Score: 5/5Safe to merge — purely additive optimistic-update logic with no server, contract, or schema changes, and comprehensive test coverage for the new paths. Both hooks follow the exact same rollback and invalidation pattern already proven by existing optimistic mutations in the file. The snapshotAndMutateRows helper is reused rather than reimplemented, case-insensitive key matching is correctly applied in both the schema filter and the row-data lookup, and onSettled ensures the cache is always reconciled with the server regardless of outcome. No data-loss or stale-state scenarios were identified. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant UI
participant useDeleteColumn / useUpdateColumn
participant QueryCache
participant Server
UI->>useDeleteColumn / useUpdateColumn: mutate(columnName / {columnName, updates})
useDeleteColumn / useUpdateColumn->>QueryCache: cancelQueries(detail)
useDeleteColumn / useUpdateColumn->>QueryCache: setQueryData(detail) — remove/patch column+widths
useDeleteColumn / useUpdateColumn->>QueryCache: cancelQueries(rowsRoot) [via snapshotAndMutateRows]
useDeleteColumn / useUpdateColumn->>QueryCache: setQueryData(rows*) — strip/rename field in each row
Note over QueryCache: optimistic state visible immediately
useDeleteColumn / useUpdateColumn->>Server: DELETE/PATCH column
alt success
Server-->>useDeleteColumn / useUpdateColumn: 200 OK
useDeleteColumn / useUpdateColumn->>QueryCache: invalidateQueries(detail + rowsRoot + lists)
QueryCache-->>UI: refetch reconciles with server
else error
Server-->>useDeleteColumn / useUpdateColumn: error
useDeleteColumn / useUpdateColumn->>QueryCache: setQueryData(detail, snapshot)
useDeleteColumn / useUpdateColumn->>QueryCache: setQueryData(rows*, snapshots)
useDeleteColumn / useUpdateColumn->>UI: toast.error(message)
useDeleteColumn / useUpdateColumn->>QueryCache: invalidateQueries(detail + rowsRoot + lists)
end
Reviews (4): Last reviewed commit: "fix(tables): toast on delete-column fail..." | Re-trigger Greptile |
…anup, rename row-data keys Address greptile review: - useDeleteColumn now toasts on non-validation errors so users see when the column "snaps back" after a server/network failure - Row data cleanup matches keys case-insensitively in both useDeleteColumn and useUpdateColumn so a column stored as "Age" is cleaned even when the request uses "age" - useUpdateColumn now migrates row-data keys when updates.name is set, preventing blank cells during the server round-trip on a rename Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@cursor review |
There was a problem hiding this comment.
✅ 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 39be514. Configure here.
|
@greptile |
|
@greptile-apps please re-review |
Summary
Test plan