diff --git a/desktop/src/components/layout/AppShell.tsx b/desktop/src/components/layout/AppShell.tsx index 5a071e2c..beebfccc 100644 --- a/desktop/src/components/layout/AppShell.tsx +++ b/desktop/src/components/layout/AppShell.tsx @@ -5,6 +5,9 @@ import { ToastContainer } from '../shared/Toast' import { useSettingsStore } from '../../stores/settingsStore' import { useKeyboardShortcuts } from '../../hooks/useKeyboardShortcuts' import { initializeDesktopServerUrl } from '../../lib/desktopRuntime' +import { TabBar } from './TabBar' +import { useTabStore } from '../../stores/tabStore' +import { useChatStore } from '../../stores/chatStore' const isTauri = typeof window !== 'undefined' && ('__TAURI_INTERNALS__' in window || '__TAURI__' in window) @@ -21,6 +24,12 @@ export function AppShell() { try { await initializeDesktopServerUrl() await fetchSettings() + // Restore tabs from localStorage + await useTabStore.getState().restoreTabs() + const activeId = useTabStore.getState().activeTabId + if (activeId) { + useChatStore.getState().connectToSession(activeId) + } if (!cancelled) { setReady(true) } @@ -92,6 +101,7 @@ export function AppShell() { )}
+
diff --git a/desktop/src/components/layout/ContentRouter.tsx b/desktop/src/components/layout/ContentRouter.tsx index 3282d476..b72be1ef 100644 --- a/desktop/src/components/layout/ContentRouter.tsx +++ b/desktop/src/components/layout/ContentRouter.tsx @@ -1,5 +1,5 @@ import { useUIStore } from '../../stores/uiStore' -import { useSessionStore } from '../../stores/sessionStore' +import { useTabStore } from '../../stores/tabStore' import { useTeamStore } from '../../stores/teamStore' import { EmptySession } from '../../pages/EmptySession' import { ActiveSession } from '../../pages/ActiveSession' @@ -9,7 +9,7 @@ import { AgentTranscript } from '../../pages/AgentTranscript' export function ContentRouter() { const activeView = useUIStore((s) => s.activeView) - const activeSessionId = useSessionStore((s) => s.activeSessionId) + const activeTabId = useTabStore((s) => s.activeTabId) const viewingAgentId = useTeamStore((s) => s.viewingAgentId) if (activeView === 'settings') { @@ -33,7 +33,7 @@ export function ContentRouter() { } // Code view - if (!activeSessionId) { + if (!activeTabId) { return }