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}}