refactor: move workspace tab navigation logic to prepareWorkspaceTab

This commit is contained in:
Mohamed Boudra
2026-03-21 15:21:02 +07:00
parent 78fc1fe862
commit 48c3308c31
17 changed files with 184 additions and 390 deletions
@@ -33,9 +33,9 @@ import { getHostRuntimeStore, isHostRuntimeConnected } from '@/runtime/host-runt
import { getIsDesktop } from '@/constants/layout'
import { projectIconQueryKey } from '@/hooks/use-project-icon-query'
import {
buildHostWorkspaceRouteWithOpenIntent,
parseHostWorkspaceRouteFromPathname,
} from '@/utils/host-routes'
import { prepareWorkspaceTab } from '@/utils/workspace-navigation'
import {
type SidebarProjectEntry,
type SidebarWorkspaceEntry,
@@ -1649,10 +1649,11 @@ export function SidebarWorkspaceList({
}, 3000)
)
onWorkspacePress?.()
router.replace(
buildHostWorkspaceRouteWithOpenIntent(serverId, workspace.id, {
kind: 'draft',
draftId: 'new',
router.navigate(
prepareWorkspaceTab({
serverId,
workspaceId: workspace.id,
target: { kind: 'draft', draftId: 'new' },
}) as any
)
} catch (error) {