@@ -95,6 +95,11 @@ export function WatcherRepositoryFields({
9595 } , [ workspaceId , setRepositories ] ) ;
9696 const branchSource = repositoryId ? ( { kind : "id" , workspaceId, repositoryId } as const ) : null ;
9797 const { branches, isLoading : branchesLoading } = useBranches ( branchSource , ! ! repositoryId ) ;
98+ // A branch name can appear twice (local + remote tracking, e.g. "main" and
99+ // origin/"main"), which would emit two <SelectItem value="main"> — Radix then
100+ // renders every matching item's text in the trigger ("mainmain") and React
101+ // warns on duplicate keys. Dedupe by name so each branch is one option.
102+ const uniqueBranchNames = Array . from ( new Set ( branches . map ( ( b ) => b . name ) ) ) ;
98103 return (
99104 < div className = "grid grid-cols-2 gap-4" >
100105 < PickSelect
@@ -116,7 +121,7 @@ export function WatcherRepositoryFields({
116121 placeholder = { branchPlaceholder ( repositoryId , branchesLoading ) }
117122 items = { [
118123 { id : DEFAULT_BRANCH , label : DEFAULT_BRANCH_LABEL } ,
119- ...branches . map ( ( b ) => ( { id : b . name , label : b . name } ) ) ,
124+ ...uniqueBranchNames . map ( ( name ) => ( { id : name , label : name } ) ) ,
120125 ] }
121126 disabled = { ! repositoryId || branchesLoading }
122127 />
0 commit comments