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 <[email protected]>
This commit is contained in:
1 parent
d6ecf15805
commit
cf66f53a55
1 file changed
+3
-1
@@ -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 ─────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in new issue
Block a user