From 7a3eba5fb1ed27cbe463f693c85877755f41fc35 Mon Sep 17 00:00:00 2001 From: Ryan Sutton Date: Thu, 30 Apr 2026 22:58:33 +0000 Subject: [PATCH 1/2] fix(branch-selector): show loading state instead of "No branches" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While the branch list is fetching, the dropdown previously rendered "No branches found." alongside the trigger spinner. Surface a dedicated "Loading branches…" row so the empty state only appears once the fetch completes. Generated-By: PostHog Code Task-Id: 322fe270-1290-4c9d-b505-1eed6961381f --- .../components/BranchSelector.tsx | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx b/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx index ed87ef2b9..08e074948 100644 --- a/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx +++ b/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx @@ -94,17 +94,21 @@ export function BranchSelector({ } }, [isSelectionOnly, defaultBranch, selectedBranch, onBranchSelect]); - const { data: localBranches = [] } = useQuery( - trpc.git.getAllBranches.queryOptions( - { directoryPath: repoPath as string }, - { enabled: !isCloudMode && !!repoPath && open, staleTime: 10_000 }, - ), - ); + const { data: localBranches = [], isLoading: localBranchesLoading } = + useQuery( + trpc.git.getAllBranches.queryOptions( + { directoryPath: repoPath as string }, + { enabled: !isCloudMode && !!repoPath && open, staleTime: 10_000 }, + ), + ); const branches = isCloudMode ? (cloudBranches ?? []) : localBranches; const effectiveLoading = loading || (isCloudMode && cloudBranchesLoading); const cloudStillLoading = isCloudMode && cloudBranchesLoading && branches.length === 0 && !open; + const branchListLoading = isCloudMode + ? !!cloudBranchesLoading + : localBranchesLoading; const checkoutMutation = useMutation( trpc.git.checkoutBranch.mutationOptions({ @@ -250,7 +254,14 @@ export function BranchSelector({ ) : null} - No branches found. + {branchListLoading && branches.length === 0 ? ( +
+ + Loading branches… +
+ ) : ( + No branches found. + )} {(item: string) => ( From aa02e170475bd0c1a52febfe5f240e8543942d86 Mon Sep 17 00:00:00 2001 From: Ryan Sutton Date: Thu, 30 Apr 2026 23:15:57 +0000 Subject: [PATCH 2/2] refactor(branch-selector): extract LoadingRow helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Greptile review feedback: the "Loading branches…" and "Loading more (N)…" rows shared identical markup. Extract a small LoadingRow helper so future style changes only need to happen in one place. Generated-By: PostHog Code Task-Id: 322fe270-1290-4c9d-b505-1eed6961381f --- .../components/BranchSelector.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx b/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx index 08e074948..ab6615bb1 100644 --- a/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx +++ b/apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx @@ -27,6 +27,15 @@ import { type RefObject, useEffect, useRef, useState } from "react"; const COMBOBOX_LIMIT = 50; +function LoadingRow({ label }: { label: string }) { + return ( +
+ + {label} +
+ ); +} + interface BranchSelectorProps { repoPath: string | null; currentBranch: string | null; @@ -248,17 +257,11 @@ export function BranchSelector({ {isCloudMode && cloudBranchesFetchingMore ? ( -
- - Loading more ({branches.length})… -
+ ) : null} {branchListLoading && branches.length === 0 ? ( -
- - Loading branches… -
+ ) : ( No branches found. )}