From cf66f53a5559be6f0117118e07793acf35ea170b Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 11 Feb 2026 15:41:27 -0800 Subject: [PATCH] Fix flash of 'Initialize git' when switching branch/worktree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- apps/web/src/components/BranchToolbar.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/BranchToolbar.tsx b/apps/web/src/components/BranchToolbar.tsx index 9fd8774d0fe31c00efe0c696ed378bffc3843d6f..2379d0b91cc0a75d2d7325ae94e2fe01f712f8b0 100644 --- a/apps/web/src/components/BranchToolbar.tsx +++ b/apps/web/src/components/BranchToolbar.tsx @@ -37,7 +37,9 @@ export default function BranchToolbar({ envMode, onEnvModeChange, envLocked }: B }); const branches = branchesQuery.data?.branches ?? []; - const isRepo = branchesQuery.data?.isRepo ?? false; + // Default to true while loading — showing "Initialize git" during a fetch is wrong, + // and worktrees are inherently git repos. + const isRepo = branchesQuery.data?.isRepo ?? !branchesQuery.isLoading; // ── Mutations ───────────────────────────────────────────────────────── -- 2.54.0