Skip to content

Commit cad3600

Browse files
fix(tables): drop the lock notice when its action stops being valid
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.
1 parent f3d8588 commit cad3600

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/tables/[tableId]

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,15 @@ export function Table({
665665
[]
666666
)
667667

668+
// A toast's action is captured when it is created, so a viewer who loses
669+
// admin access mid-toast would keep a Lock settings button that opens
670+
// nothing. Drop the notice instead of leaving it dead.
671+
useEffect(() => {
672+
if (canOpenLockSettings || !blockedToastIdRef.current) return
673+
toast.dismiss(blockedToastIdRef.current)
674+
blockedToastIdRef.current = null
675+
}, [canOpenLockSettings])
676+
668677
const headerActions = useMemo(() => {
669678
if (!tableData) return undefined
670679
return [

0 commit comments

Comments
 (0)