feat(tables): autosave persisted default views - #6724
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Hydration and selection move into Views menu shows the default name instead of a generic label, hides the synthetic All row when a default exists, and blocks delete on the default view. SaveViewModal drops the Backend / forks: table creation and workspace fork copy insert default views; forked legacy tables without views get a Default seeded from table metadata. The Reviewed by Cursor Bugbot for commit 2a379fa. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR replaces the unsaved state of newly created tables with persisted default views and adds autosaving and hydration reconciliation for view configuration.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; both previously reported issues are fixed in the current code.
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx | Adds persisted-default resolution, initial-state preservation, serialized autosave routing, and default-view lifecycle handling without leaving an eligible follow-up defect. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/view-state.ts | Centralizes active/default selection, metadata inheritance, and revision comparison for table-view hydration. |
| apps/sim/hooks/queries/tables.ts | Serializes view mutations per table and reconciles returned revisions without holding the mutation queue open for refetching. |
| apps/sim/lib/table/service.ts | Creates each new table and its persisted default view within the same database transaction. |
| apps/sim/ee/workspace-forking/lib/copy/copy-resources.ts | Fixes the prior fork issue by copying source views to remapped table IDs and seeding a default for legacy tables. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/views-menu/views-menu.test.tsx | Adds genuine DOM interaction coverage, making the file-level jsdom environment appropriate. |
| packages/db/schema.ts | Updates table-view schema documentation to reflect persisted defaults while retaining the existing uniqueness constraint. |
Sequence Diagram
sequenceDiagram
participant UI as Table UI
participant Cache as Views Query Cache
participant API as Table View API
participant DB as Postgres
UI->>Cache: Resolve selected or default view
Cache-->>UI: Active view configuration
UI->>UI: Apply filter, sort, columns, and layout
UI->>API: Autosave configuration patch
API->>DB: Merge patch into persisted view
DB-->>API: Updated view revision
API-->>Cache: Reconcile cached view
Cache-->>UI: Apply newer revision after queue settles
Reviews (8): Last reviewed commit: "fix(tables): preserve valid saved sort o..." | Re-trigger Greptile
9bdac1d to
30c1a95
Compare
|
@cursor review |
30c1a95 to
bbb38f2
Compare
|
@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 bbb38f2. Configure here.
bbb38f2 to
17c16ea
Compare
17c16ea to
43482c2
Compare
43482c2 to
ea31794
Compare
|
@cursor review |
ea31794 to
677a2fa
Compare
|
@cursor review |
677a2fa to
daefc28
Compare
|
@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 daefc28. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 03a4e49. Configure here.
Creating the first view left isDefault false, so the legacy All fallback stayed in the menu instead of handing off to the new view. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Summary
This first PR in a two-layer table-views stack replaces the unsaved "All" state for new tables with a persisted "Default" view. When
table-viewsis enabled, filter, sort, column visibility, and layout changes autosave to the active view, and returning to a table restores the saved default configuration.Existing tables without a persisted view keep the legacy "All" fallback; this PR intentionally adds no backfill migration. Workspace forks now copy every saved table view, and a copied legacy table receives a persisted "Default" view seeded from its current table configuration so the fork preserves what users see.
Initial hydration preserves a deep-linked sort and queues filter, sort, or hidden-column gestures made before the views query identifies their owner. A stale
table-viewURL adopts the real default before pending layout is resolved, so an early resize is never written to the legacy table metadata under the wrong owner.Upgrading a legacy
AllURL to the persisted default also preserves and flushes any local work completed during hydration. Layout and hidden-column metadata written while the flag was off remains the baseline for fields an ungated Default view has not stored yet, and early layout gestures are saved to the owner chosen during hydration. Same-view autosave echoes use order-insensitive structural equality to skip an identical filter instead of remounting the editor and wiping an in-progress draft. A newly created blank view stays blank while its query-cache row and URL selection catch up, and deleting a sorted column removes the dead sort from both the URL and persisted view. The current default cannot be deleted from the Views menu; another view must become default first, so the table always retains an autosave owner.The feature flag remains a UI gate: view controls, fetching, hydration, and autosave stay behind
table-viewsin both table-detail and embedded surfaces. The routes and persistence layer remain available by design, and new or forked tables create/copy view rows even while the flag is off so rollout state survives toggles. With the flag off, users continue to get the legacy Filter/Sort behavior.The child PR, #6725, adds default-view selection and refines the view, column, and filter controls.
Type of Change
Testing
bun run lintandbun run lint:checkbun run check:audits(30 repository policy audits)bun run type-check(26 package tasks)bun run apps/sim/scripts/check-block-registry.ts origin/stagingbun run check:migrations origin/stagingChecklist
Screenshots/Videos
Not included. Automated tests cover default selection, reload hydration, autosave behavior, and workspace-fork preservation.
Post-Deploy Monitoring & Validation