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
@@ -24,7 +24,7 @@ type Args = {
setDirectory: (directory: string, options?: { showOverlay?: boolean }) => void;
setActiveMainTab: (tab: 'chat' | 'plan' | 'git' | 'diff' | 'terminal' | 'files') => void;
setSessionSwitcherOpen: (open: boolean) => void;
setCurrentSession: (sessionId: string | null) => void;
setCurrentSession: (sessionId: string | null, directoryHint?: string | null) => void;
updateSessionTitle: (id: string, title: string) => Promise<void>;
shareSession: (id: string) => Promise<Session | null>;
unshareSession: (id: string) => Promise<Session | null>;
@@ -93,7 +93,7 @@ export const useSessionActions = (args: Args) => {
resetSessionSearch();
return;
}
args.setCurrentSession(sessionId);
args.setCurrentSession(sessionId, sessionDirectory ?? null);
args.onSessionSelected?.(sessionId);
resetSessionSearch();
},