fix(desktop): coding rail reads only its own worktree

The row fell back to the global $repoStatus whenever repoPath was blank,
painting the main pane's branch and ± onto a tile whose cwd hadn't
resolved yet. The fallback bought nothing — the primary computed is keyed
to $currentCwd, which is empty in exactly that case — and cost a rail
showing a tree the session was never in.
This commit is contained in:
Brooklyn Nicholson 2026-07-30 12:27:23 -05:00
parent c48d9a9c6d
commit 8f4ab7ad2c

View file

@ -16,8 +16,6 @@ import { DiffCount } from '@/components/ui/diff-count'
import type { HermesGitBranch } from '@/global'
import { useI18n } from '@/i18n'
import {
$repoStatus,
$repoWorktrees,
registerRepoStatusCwd,
repoStatusForCwd,
repoWorktreesForCwd
@ -69,10 +67,13 @@ export const CodingStatusRow = memo(function CodingStatusRow({
const s = t.statusStack.coding
const p = t.sidebar.projects
const resolvedRepoPath = repoPath?.trim() || undefined
// Per-cwd slice when this surface knows its worktree (tiles); otherwise the
// primary main-pane computed — so a blank/missing repoPath still paints.
const status = useStore(resolvedRepoPath ? repoStatusForCwd(resolvedRepoPath) : $repoStatus)
const worktrees = useStore(resolvedRepoPath ? repoWorktreesForCwd(resolvedRepoPath) : $repoWorktrees)
// This surface's OWN worktree, always — never the primary's. The row used to
// fall back to the global `$repoStatus` for a blank repoPath, which painted
// the main pane's branch/± onto a tile whose cwd hadn't resolved yet. That
// fallback bought nothing (the primary's computed is keyed to `$currentCwd`,
// which is blank in exactly the same case) and cost a wrong-tree rail.
const status = useStore(repoStatusForCwd(resolvedRepoPath))
const worktrees = useStore(repoWorktreesForCwd(resolvedRepoPath))
// While mounted, keep this worktree in the coding-status refresh set so the
// turn-settle / tool-complete / focus edges re-probe it too (tiles otherwise