authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-11 15:41:27-08:00
committergravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-11 15:41:27-08:00
logcf66f53a5559be6f0117118e07793acf35ea170b
treee8df838e4f66c0cda973a680dec6afd8cf112ca4
parentd6ecf1580510cd7f156dbe831c68f357fe162210

Fix flash of 'Initialize git' when switching branch/worktree

branchesQuery.data is undefined while loading, so isRepo defaulted to false — briefly showing the init button even for worktrees. Now defaults to true while loading (only shows init when the query actually returns isRepo: false). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

1 files changed, 3 insertions(+), 1 deletions(-)

apps/web/src/components/BranchToolbar.tsx+3-1
...@@ -37,7 +37,9 @@ export default function BranchToolbar({ envMode, onEnvModeChange, envLocked }: B...@@ -37,7 +37,9 @@ export default function BranchToolbar({ envMode, onEnvModeChange, envLocked }: B
37 });37 });
3838
39 const branches = branchesQuery.data?.branches ?? [];39 const branches = branchesQuery.data?.branches ?? [];
40 const isRepo = branchesQuery.data?.isRepo ?? false;40 // Default to true while loading — showing "Initialize git" during a fetch is wrong,
41 // and worktrees are inherently git repos.
42 const isRepo = branchesQuery.data?.isRepo ?? !branchesQuery.isLoading;
4143
42 // ── Mutations ─────────────────────────────────────────────────────────44 // ── Mutations ─────────────────────────────────────────────────────────
4345