diff --git a/packages/ui/src/components/chat/ChatContainer.tsx b/packages/ui/src/components/chat/ChatContainer.tsx index 211ae419..5dad0ef1 100644 --- a/packages/ui/src/components/chat/ChatContainer.tsx +++ b/packages/ui/src/components/chat/ChatContainer.tsx @@ -11,7 +11,6 @@ import { useChatScrollManager } from '@/hooks/useChatScrollManager'; import { useDeviceInfo } from '@/lib/device'; import { Button } from '@/components/ui/button'; import { OverlayScrollbar } from '@/components/ui/OverlayScrollbar'; -import { isVSCodeRuntime } from '@/lib/desktop'; export const ChatContainer: React.FC = () => { const { @@ -41,14 +40,10 @@ export const ChatContainer: React.FC = () => { const draftOpen = Boolean(newSessionDraft?.open); React.useEffect(() => { - if (isMobile || isVSCodeRuntime()) { - return; - } - if (!currentSessionId && !draftOpen) { openNewSessionDraft(); } - }, [currentSessionId, draftOpen, isMobile, openNewSessionDraft]); + }, [currentSessionId, draftOpen, openNewSessionDraft]); const sessionMessages = React.useMemo(() => { diff --git a/packages/ui/src/components/layout/VSCodeLayout.tsx b/packages/ui/src/components/layout/VSCodeLayout.tsx index 1f690af8..547a2916 100644 --- a/packages/ui/src/components/layout/VSCodeLayout.tsx +++ b/packages/ui/src/components/layout/VSCodeLayout.tsx @@ -46,12 +46,12 @@ export const VSCodeLayout: React.FC = () => { } }, [currentSessionId]); - // If the active session disappears (e.g., deleted), stay on the sessions list + // If the active session disappears (e.g., deleted), show a new chat view React.useEffect(() => { - if (!currentSessionId && !newSessionDraftOpen && currentView === 'chat') { - setCurrentView('sessions'); + if (!currentSessionId && !newSessionDraftOpen) { + openNewSessionDraft(); } - }, [currentSessionId, currentView, newSessionDraftOpen]); + }, [currentSessionId, newSessionDraftOpen, openNewSessionDraft]); const handleBackToSessions = React.useCallback(() => { setCurrentView('sessions');