fix(desktop): toggle every pane off the tree, not off its own boolean

The terminal fix was only one instance. An audit of the other pane toggles
found ⌘G and ⌘J diverging the same way, proven with a probe: with review
stacked behind files in the right column, or either pane inside a minimized
zone, the store reads open while nothing is on screen, so the press
re-asserts a value it already held and the key does nothing.

isPaneVisible / togglePaneVisible replace the tool-panel-only pair and now
back every toggle. Close still routes through closeTreePane, so each pane
keeps its own semantics: a tool panel collapses to its rail, files and
review close through their store, anything else is dismissed.

files and review were bound with a closer and no opener, so the boolean went
stale as soon as anything but the toggle revealed them. bindPaneVisibility
moves into the tree store beside bindToolPaneCollapse, documents the two as a
pair, and both panes now pass both halves. Keeping the binding in the store
also means the tests drive the real function — the earlier copy in the test
file passed with the fix reverted, which is how the missing opener survived
the first pass.

setTreePaneHidden keeps its quiet path: a reactive unhide (a cwd arriving)
must not front or un-minimize over what the user is looking at. Only user
intent goes through the reveal path.
This commit is contained in:
Brooklyn Nicholson
2026-08-01 01:17:45 -05:00
parent 16431b8ab2
commit 73b8847d7b
8 changed files with 254 additions and 70 deletions
@@ -5,7 +5,7 @@ import type { CommandCenterSection } from '@/app/command-center'
import { useApprovalModeStatusbarItem } from '@/app/shell/approval-mode-menu'
import { ContextUsagePanel } from '@/app/shell/context-usage-panel'
import { GatewayMenuPanel } from '@/app/shell/gateway-menu-panel'
import { $toolPaneVisible, toggleToolPane } from '@/components/pane-shell/tree/store'
import { $paneVisible, togglePaneVisible } from '@/components/pane-shell/tree/store'
import { Codicon } from '@/components/ui/codicon'
import { GlyphSpinner } from '@/components/ui/glyph-spinner'
import { useI18n } from '@/i18n'
@@ -95,7 +95,7 @@ export function useStatusbarItems({
// What the button paints and flips is whether the terminal is ON SCREEN —
// the takeover store alone stays true behind a stacked sibling tab or a
// minimized zone, which lit the button for a pane the user couldn't see.
const terminalShowing = useStore($toolPaneVisible('terminal'))
const terminalShowing = useStore($paneVisible('terminal'))
const primaryBusy = useStore($busy)
const currentCwd = useStore($currentCwd)
// Derive the workspace's project name from the already-cached project tree
@@ -513,7 +513,7 @@ export function useStatusbarItems({
hidden: !chatOpen,
icon: <Terminal className="size-3.5" />,
id: 'terminal',
onSelect: () => toggleToolPane('terminal'),
onSelect: () => togglePaneVisible('terminal'),
title: terminalShowing ? copy.hideTerminal : copy.showTerminal,
toggleLabel: copy.toggleTerminal,
variant: 'action'