Skip to content

Commit 08400f5

Browse files
waleedlatif1claude
andcommitted
fix(workspaces): skip prune when workspace list is empty on mount
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2fc98fb commit 08400f5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-workspace-management.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ export function useWorkspaceManagement({
6868
if (lastTouchedRef.current === id) return
6969
lastTouchedRef.current = id
7070
WorkspaceRecencyStorage.touch(id)
71-
WorkspaceRecencyStorage.prune(new Set(workspacesRef.current.map((w) => w.id)))
71+
const validIds = workspacesRef.current.map((w) => w.id)
72+
if (validIds.length > 0) {
73+
WorkspaceRecencyStorage.prune(new Set(validIds))
74+
}
7275
setRecencySortKey((k) => k + 1)
7376

7477
if (syncTimerRef.current) clearTimeout(syncTimerRef.current)

0 commit comments

Comments
 (0)