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..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; @@ -94,17 +103,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({ @@ -244,13 +257,14 @@ export function BranchSelector({ {isCloudMode && cloudBranchesFetchingMore ? ( -
- - Loading more ({branches.length})… -
+ ) : null} - No branches found. + {branchListLoading && branches.length === 0 ? ( + + ) : ( + No branches found. + )} {(item: string) => (