Skip to content

Commit 8764954

Browse files
Revert "fix switch workspace bug (#560)" (#563)
This reverts commit 0fb2f7c.
1 parent 76a0425 commit 8764954

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/workspace-header.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ export const WorkspaceHeader = React.memo<WorkspaceHeaderProps>(
343343
setActiveWorkspace(workspace)
344344
setWorkspaceDropdownOpen(false)
345345

346-
// Update URL first so sidebar filters use the new workspace ID
347-
router.push(`/workspace/${workspace.id}/w`)
348-
349-
// Then switch workspace which will clear workflows and fetch new ones
346+
// Use full workspace switch which now handles localStorage automatically
350347
switchToWorkspace(workspace.id)
348+
349+
// Update URL to include workspace ID
350+
router.push(`/workspace/${workspace.id}/w`)
351351
},
352352
[activeWorkspace?.id, switchToWorkspace, router, setWorkspaceDropdownOpen]
353353
)
@@ -372,11 +372,12 @@ export const WorkspaceHeader = React.memo<WorkspaceHeaderProps>(
372372
setWorkspaces((prev) => [...prev, newWorkspace])
373373
setActiveWorkspace(newWorkspace)
374374

375-
// Update URL first so sidebar filters use the new workspace ID
376-
router.push(`/workspace/${newWorkspace.id}/w`)
377-
378-
// Then switch workspace which will clear workflows and fetch new ones
375+
// Use switchToWorkspace to properly load workflows for the new workspace
376+
// This will clear existing workflows, set loading state, and fetch workflows from DB
379377
switchToWorkspace(newWorkspace.id)
378+
379+
// Update URL to include new workspace ID
380+
router.push(`/workspace/${newWorkspace.id}/w`)
380381
}
381382
} catch (err) {
382383
logger.error('Error creating workspace:', err)

0 commit comments

Comments
 (0)