Skip to content

Commit 21e9deb

Browse files
mishrapraffulclaude
andcommitted
fix: resolve branch name display issues in session header
- Show folder name (last path segment) instead of full worktree path, preventing the branch name from appearing twice when the path embeds it - Fetch the live git branch from the worktree/repo path every 3s so the displayed branch stays current when the user checks out a different branch - Always show the current branch (including main) since it is now fetched dynamically rather than relying on the static session.branchName field Fixes #31 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent dfa7aa6 commit 21e9deb

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

src/renderer/components/SessionView/SessionView.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,26 @@ export function SessionView() {
5454
}, [isRunning]);
5555

5656
const worktreePath = session?.worktreePath;
57-
const branchName = session?.branchName ?? null;
57+
const folderName = worktreePath?.split("/").pop() ?? null;
58+
59+
const [liveBranch, setLiveBranch] = useState<string | null>(null);
60+
61+
useEffect(() => {
62+
if (!worktreePath) {
63+
setLiveBranch(null);
64+
return;
65+
}
66+
67+
const fetchBranch = () => {
68+
window.electronAPI.getRepoBranch(worktreePath).then((branch) => {
69+
setLiveBranch(branch);
70+
});
71+
};
72+
73+
fetchBranch();
74+
const interval = setInterval(fetchBranch, 3000);
75+
return () => clearInterval(interval);
76+
}, [worktreePath]);
5877

5978
if (!activeSessionId || !session) {
6079
return (
@@ -75,8 +94,8 @@ export function SessionView() {
7594
<div className="flex-1 flex flex-col min-h-0">
7695
{/* Session header */}
7796
<div className="h-10 flex items-center px-4 border-b border-border gap-2">
78-
<span className="text-sm font-medium text-text-primary font-mono">{worktreePath}</span>
79-
{branchName && <span className="text-xs text-text-muted font-mono">{branchName}</span>}
97+
<span className="text-sm font-medium text-text-primary font-mono">{folderName}</span>
98+
{liveBranch && <span className="text-xs text-text-muted font-mono">{liveBranch}</span>}
8099
<StatusBadge status={session.status} />
81100
</div>
82101

0 commit comments

Comments
 (0)