Skip to content

Commit 072f658

Browse files
fix(tables): clear the lock notice when switching tables
Switching tables reuses this component rather than remounting it, and the notice is exempt from the provider's route sweep, so a locked table's announcement stayed on screen over the next table — where its action would have opened that table's lock settings instead. Key the cleanup on tableId.
1 parent 260314a commit 072f658

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

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

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,13 +656,17 @@ export function Table({
656656
showBlockedToast('status')
657657
}, [tableData, userPermissions.isLoading, showBlockedToast])
658658

659-
// Counterpart to `persistAcrossRoutes` above: this view's toasts don't trail
660-
// the user once it goes away.
659+
// Counterpart to `persistAcrossRoutes` above: a notice must not outlive the
660+
// table it describes. Keyed on `tableId` because switching tables reuses this
661+
// component instead of remounting it, and the action would then target the
662+
// table the user just moved to.
661663
useEffect(
662664
() => () => {
663-
if (blockedToastIdRef.current) toast.dismiss(blockedToastIdRef.current)
665+
if (!blockedToastIdRef.current) return
666+
toast.dismiss(blockedToastIdRef.current)
667+
blockedToastIdRef.current = null
664668
},
665-
[]
669+
[tableId]
666670
)
667671

668672
// A toast's action is captured when it is created, so a viewer who loses

0 commit comments

Comments
 (0)