feat(chat): remove mobile check and open new session draft when no active session

This commit is contained in:
Bohdan Triapitsyn
2025-12-22 01:29:11 +02:00
parent 5e103394d7
commit d2b3d056cc
2 changed files with 5 additions and 10 deletions
@@ -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(() => {
@@ -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');