Skip to content

improvement(tables): announce locks on open instead of a header chip - #5979

Open
TheodoreSpeaks wants to merge 4 commits into
stagingfrom
fix/table-lock-followup
Open

improvement(tables): announce locks on open instead of a header chip#5979
TheodoreSpeaks wants to merge 4 commits into
stagingfrom
fix/table-lock-followup

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • Removed the lock entry from the table header actions — the header is back to just Import CSV / Export CSV
  • A locked table now announces itself once on open with an info toast, carrying a Lock settings action button for admins
  • Non-admins get the same notice without the button; blocked-action toasts are unchanged
  • The breadcrumb dropdown keeps its "Lock settings" item, so admins still have a permanent way into the panel on an unlocked table

The announcement is marked shown as soon as the table resolves, so an admin who just set locks in the panel doesn't immediately get toasted about them.

Type of Change

  • Improvement (UX)

Testing

Tested manually. bun run type-check, bun run lint:check, and the full audit suite (boundaries, api-validation:strict, utils, zustand-v5, react-query, client-boundary, bare-icons, icon-paths, realtime-prune, skills:check, agent-stream-docs:check) all pass.

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)

Drop the lock entry from the table header actions. A locked table now announces
itself once on open via an info toast carrying the Lock settings action for
admins; the breadcrumb dropdown remains the permanent entry point.
@vercel

vercel Bot commented Jul 27, 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 Jul 27, 2026 9:06pm

Request Review

@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Table detail UX and toast behavior only; lock enforcement and server logic are unchanged.

Overview
Locked tables no longer show a lock chip in the header (Import/Export only). Opening a table with any locks triggers a one-time info toast describing what is locked; admins still get a Lock settings action on that toast and in the breadcrumb menu.

Lock toasts use toast.info for the on-open 'status' case (vs warning for blocked actions), persistAcrossRoutes so warm navigations don’t clear the announcement, plus unmount dismiss and dismiss when admin access is lost so stale actions don’t linger. The announcement waits until canAdmin finishes loading before deciding whether to show the settings button.

lock-copy comments now describe this toast-based flow instead of the header chip.

Reviewed by Cursor Bugbot for commit cad3600. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR replaces the table-header lock indicator with a one-time lock-status toast and now dismisses actionable lock notices when administrative access is lost.

  • Removes the lock chip from table header actions.
  • Announces locked tables through an informational toast after permissions resolve.
  • Keeps actionable notices across route-change sweeps while dismissing them on view unmount.
  • Dismisses an active lock-settings toast when the viewer loses permission to open the panel.

Confidence Score: 5/5

The PR appears safe to merge.

The prior stale-permission action is dismissed when administrative access or online capability is lost, and the lock settings modal remains independently gated by current administrator permission, so no blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/lock-copy.ts Updates documentation to reflect that lock status is announced through toasts rather than a header chip.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx Moves lock-status presentation to a one-time toast and safely removes its captured settings action when administrative access becomes unavailable.

Reviews (3): Last reviewed commit: "fix(tables): drop the lock notice when i..." | Re-trigger Greptile

Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx Outdated
Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx Outdated
The lock announcement fires once per table, so a canAdmin that is still false
because permissions have not resolved permanently drops the toast's Lock
settings action. Arm the one-shot on the permissions decision rather than on
table resolution.
Comment thread apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx
The toast provider clears route-scoped toasts in a pathname effect that runs
after child effects, so an announcement fired on a warm-cache navigation was
added and removed in the same commit. Opt these toasts out of the sweep and
dismiss them on unmount so they still don't trail the user.
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

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 f3d8588. Configure here.

A toast's action is captured at creation, so a viewer whose admin access is
revoked while the announcement is on screen kept a Lock settings button that
opened nothing. Dismiss the notice when the action is no longer available.
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

Addressed the outstanding toast-action lifecycle concern in cad3600.

The observation was correct: a toast's action is captured when the toast is created, so a viewer whose admin access was revoked during the ~8s the announcement is on screen kept a Lock settings button that opened nothing — LockSettingsModal is gated on userPermissions.canAdmin at render (and the route is enforced server-side), so there was never an access impact, but the dead button was real.

Rather than trying to keep a live action in a static toast, the view now drops the notice when the action stops being valid:

useEffect(() => {
  if (canOpenLockSettings || !blockedToastIdRef.current) return
  toast.dismiss(blockedToastIdRef.current)
  blockedToastIdRef.current = null
}, [canOpenLockSettings])

This pairs with the unmount cleanup added in f3d8588 — the view owns its toasts' lifecycle end-to-end, which is what persistAcrossRoutes: true obliges it to do.

One direction deliberately not handled: a viewer who gains admin mid-toast keeps the buttonless notice for its remaining duration. That fails safe (the breadcrumb dropdown is the permanent entry point) and re-creating a toast under the user to add a button would be worse than leaving it.

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

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.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cad3600. Configure here.

if (canOpenLockSettings || !blockedToastIdRef.current) return
toast.dismiss(blockedToastIdRef.current)
blockedToastIdRef.current = null
}, [canOpenLockSettings])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Announcement dismissed for non-admins

High Severity

A new useEffect dismisses lock status toasts when canOpenLockSettings is false. Because this effect runs on mount and canOpenLockSettings is always false for non-admins, it immediately dismisses the initial lock status announcement toast. Non-admins therefore don't see the lock status when navigating to a table.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cad3600. Configure here.

if (canOpenLockSettings || !blockedToastIdRef.current) return
toast.dismiss(blockedToastIdRef.current)
blockedToastIdRef.current = null
}, [canOpenLockSettings])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale toast after clearing locks

Medium Severity

The useEffect that announces table lock status uses a latch that prevents re-evaluation. This can lead to stale lock status toasts persisting after locks are cleared, and prevents the "Lock settings" action from appearing if admin permissions were initially false but later granted.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cad3600. Configure here.

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