From 21e9deb6f4d34d8019d884cf5b79566e93a95b6d Mon Sep 17 00:00:00 2001 From: mishraprafful Date: Thu, 2 Apr 2026 13:50:21 +0200 Subject: [PATCH] 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 --- .../components/SessionView/SessionView.tsx | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/SessionView/SessionView.tsx b/src/renderer/components/SessionView/SessionView.tsx index a4a2aed..a2c7eed 100644 --- a/src/renderer/components/SessionView/SessionView.tsx +++ b/src/renderer/components/SessionView/SessionView.tsx @@ -54,7 +54,26 @@ export function SessionView() { }, [isRunning]); const worktreePath = session?.worktreePath; - const branchName = session?.branchName ?? null; + const folderName = worktreePath?.split("/").pop() ?? null; + + const [liveBranch, setLiveBranch] = useState(null); + + useEffect(() => { + if (!worktreePath) { + setLiveBranch(null); + return; + } + + const fetchBranch = () => { + window.electronAPI.getRepoBranch(worktreePath).then((branch) => { + setLiveBranch(branch); + }); + }; + + fetchBranch(); + const interval = setInterval(fetchBranch, 3000); + return () => clearInterval(interval); + }, [worktreePath]); if (!activeSessionId || !session) { return ( @@ -75,8 +94,8 @@ export function SessionView() {
{/* Session header */}
- {worktreePath} - {branchName && {branchName}} + {folderName} + {liveBranch && {liveBranch}}