Skip to content

Commit 260314a

Browse files
fix(tables): only drop the lock notice when access is actually lost
The dismiss effect treated "has no access" the same as "just lost access", so on a warm-cache mount — where the announcement and the dismiss both run in the mount commit — a non-admin's notice was torn down the moment it was created. Dismiss on the true-to-false transition only.
1 parent cad3600 commit 260314a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

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

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,13 @@ export function Table({
667667

668668
// A toast's action is captured when it is created, so a viewer who loses
669669
// admin access mid-toast would keep a Lock settings button that opens
670-
// nothing. Drop the notice instead of leaving it dead.
670+
// nothing. Dismiss on that transition only — a viewer who never had access
671+
// has a legitimate action-less notice that must survive.
672+
const couldOpenLockSettingsRef = useRef(canOpenLockSettings)
671673
useEffect(() => {
672-
if (canOpenLockSettings || !blockedToastIdRef.current) return
674+
const lostAccess = couldOpenLockSettingsRef.current && !canOpenLockSettings
675+
couldOpenLockSettingsRef.current = canOpenLockSettings
676+
if (!lostAccess || !blockedToastIdRef.current) return
673677
toast.dismiss(blockedToastIdRef.current)
674678
blockedToastIdRef.current = null
675679
}, [canOpenLockSettings])

0 commit comments

Comments
 (0)