From 60f6f973871ded5f5a8d23e2561e346f7bd2acc6 Mon Sep 17 00:00:00 2001 From: ParsaKhaz Date: Fri, 12 Jun 2026 15:25:04 -0700 Subject: [PATCH 1/4] fix: new panes focus explorer, default order explorer/diff/browser New panes were auto-focusing the diff tab, and only by accident: the three default panels are created in a parallel Promise.all and each createPanel marks itself active, so the race winner got focus. Diff is also the slowest default to render. - explicitly set the explorer panel active after default panel creation (session creation and main repo session creation) - default tab order becomes Explorer, Diff, Browser in all three sort sites (top bar fallback, initial layout creation, session panel sort) Existing panes keep their order: stored layouts bake panel order, and the sorts only apply when no layout exists yet. --- frontend/src/components/SessionView.tsx | 12 ++++++------ frontend/src/components/panels/PanelTabBar.tsx | 6 +++--- main/src/services/sessionManager.ts | 8 ++++++++ main/src/services/taskQueue.ts | 10 ++++++++++ 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/SessionView.tsx b/frontend/src/components/SessionView.tsx index a6f7afb2..ab754250 100644 --- a/frontend/src/components/SessionView.tsx +++ b/frontend/src/components/SessionView.tsx @@ -263,10 +263,10 @@ export const SessionView = memo(() => { const pinned = loadedPanels.find(p => p.type === 'terminal'); const livePanels = pinned ? loadedPanels.filter(p => p.id !== pinned.id) : loadedPanels; - // Sort for initial layout creation (diff first, explorer second, then position) + // Sort for initial layout creation (explorer first, diff second, then position) const typeOrder = (type: string) => { - if (type === 'diff') return 0; - if (type === 'explorer') return 1; + if (type === 'explorer') return 0; + if (type === 'diff') return 1; return 2; }; const sortedLive = [...livePanels].sort((a, b) => { @@ -415,11 +415,11 @@ export const SessionView = memo(() => { [sessionPanels, defaultTerminalPanel] ); - // Sort tab bar panels same as PanelTabBar: diff first, explorer second, then by position + // Sort tab bar panels same as PanelTabBar: explorer first, diff second, then by position const sortedSessionPanels = useMemo(() => { const typeOrder = (type: string) => { - if (type === 'diff') return 0; - if (type === 'explorer') return 1; + if (type === 'explorer') return 0; + if (type === 'diff') return 1; return 2; }; return [...tabBarPanels].sort((a, b) => { diff --git a/frontend/src/components/panels/PanelTabBar.tsx b/frontend/src/components/panels/PanelTabBar.tsx index e76823e4..fb54d988 100644 --- a/frontend/src/components/panels/PanelTabBar.tsx +++ b/frontend/src/components/panels/PanelTabBar.tsx @@ -458,11 +458,11 @@ export const PanelTabBar: React.FC = memo(({ } }; - // Sort panels: diff first, explorer second, then by position + // Sort panels: explorer first, diff second, then by position const sortedPanels = useMemo(() => { const typeOrder = (type: string) => { - if (type === 'diff') return 0; - if (type === 'explorer') return 1; + if (type === 'explorer') return 0; + if (type === 'diff') return 1; if (type === 'browser') return 2; return 3; }; diff --git a/main/src/services/sessionManager.ts b/main/src/services/sessionManager.ts index 5fd01d18..ec663ce5 100644 --- a/main/src/services/sessionManager.ts +++ b/main/src/services/sessionManager.ts @@ -474,6 +474,14 @@ export class SessionManager extends EventEmitter { await panelManager.ensureExplorerPanel(session.id); await panelManager.ensureDiffPanel(session.id); + // Explorer is the intended initial tab (the diff creation above just + // stole active by being the last createPanel). + const explorerPanel = panelManager + .getPanelsForSession(session.id) + .find((p) => p.type === 'explorer'); + if (explorerPanel) { + await panelManager.setActivePanel(session.id, explorerPanel.id); + } return session; }); } diff --git a/main/src/services/taskQueue.ts b/main/src/services/taskQueue.ts index bbdab199..dfc9c2ed 100644 --- a/main/src/services/taskQueue.ts +++ b/main/src/services/taskQueue.ts @@ -274,6 +274,16 @@ export class TaskQueue { panelManager.ensureBrowserPanel(session.id), ]); + // Each createPanel marks the new panel active, so the parallel ensures + // leave a race winner focused. Explorer is the intended initial tab + // (renders instantly; diff can take a moment on big worktrees). + const explorerPanel = panelManager + .getPanelsForSession(session.id) + .find((p) => p.type === 'explorer'); + if (explorerPanel) { + await panelManager.setActivePanel(session.id, explorerPanel.id); + } + // Emit the session-created event BEFORE running build script so UI shows immediately sessionManager.emitSessionCreated(session); From 780084eb941a8909613547d08fd9a79eb69458bf Mon Sep 17 00:00:00 2001 From: ParsaKhaz Date: Fri, 12 Jun 2026 16:14:55 -0700 Subject: [PATCH 2/4] fix: tab divider follows the rightmost default tool, not the browser tab the divider was hardcoded to render after the browser tab, so reordering the defaults dragged the separator into the middle of the strip. it now sits after the rightmost diff/explorer/browser tab and is suppressed when that tab is last in the strip --- frontend/src/components/panels/PanelTabStrip.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/panels/PanelTabStrip.tsx b/frontend/src/components/panels/PanelTabStrip.tsx index 23ecdfc4..0c8aa444 100644 --- a/frontend/src/components/panels/PanelTabStrip.tsx +++ b/frontend/src/components/panels/PanelTabStrip.tsx @@ -222,6 +222,18 @@ export const PanelTabStrip: React.FC = React.memo(({ if (el) el.focus(); }, []); + // The divider separates the default tool tabs (diff/explorer/browser) from + // the working tabs. It sits after the RIGHTMOST default in the strip, not + // after a hardcoded type, so reordering the defaults moves it correctly. + // Suppressed when the rightmost default is the strip's last tab. + const lastDefaultIndex = useMemo(() => { + let last = -1; + panels.forEach((p, idx) => { + if (p.type === 'diff' || p.type === 'explorer' || p.type === 'browser') last = idx; + }); + return last; + }, [panels]); + // Shortcut hints are only truthful when the hotkeys actually target this // strip's panels: Mod+Shift+1-9 act on the focused group, so hide hints // while a different group has focus. @@ -357,7 +369,7 @@ export const PanelTabStrip: React.FC = React.memo(({ ); - const showDividerAfter = !compact && panel.type === 'browser'; + const showDividerAfter = !compact && index === lastDefaultIndex && index < panels.length - 1; const divider = showDividerAfter ? (