fix: keep selected session header details stable

- Prevent header flicker to Untitled during session refresh
- Resolve header session data from global sessions first
- Pass session directory hints on more session-switch paths
This commit is contained in:
Bohdan Triapitsyn
2026-04-03 12:38:03 +03:00
parent dd0587501f
commit 9d78c48949
4 changed files with 84 additions and 14 deletions
@@ -1,6 +1,6 @@
import React from 'react';
import { RiArrowLeftLine } from '@remixicon/react';
import type { Message, Part } from '@opencode-ai/sdk/v2';
import type { Message, Part, Session } from '@opencode-ai/sdk/v2';
import { ChatInput } from './ChatInput';
import { useUIStore } from '@/stores/useUIStore';
@@ -191,7 +191,8 @@ export const ChatContainer: React.FC = () => {
const handleReturnToParentSession = React.useCallback(() => {
if (!parentSession) return;
setCurrentSession(parentSession.id);
const parentDirectory = (parentSession as Session & { directory?: string | null }).directory ?? null;
setCurrentSession(parentSession.id, parentDirectory);
}, [parentSession, setCurrentSession]);
const returnToParentButton = parentSession ? (