File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
apps/array/src/renderer/features/task-detail/components Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ export function BranchSelect({
144144 }
145145 } ;
146146
147- // filter branches based on search query
147+ // filter and sort branches based on search query
148148 const filteredBranches = useMemo ( ( ) => {
149149 let result = branches ;
150150 if ( searchQuery . trim ( ) ) {
@@ -153,8 +153,14 @@ export function BranchSelect({
153153 branch . toLowerCase ( ) . includes ( query ) ,
154154 ) ;
155155 }
156+ // Sort alphabetically, but default branch always comes first
157+ result = [ ...result ] . sort ( ( a , b ) => {
158+ if ( a === defaultBranch ) return - 1 ;
159+ if ( b === defaultBranch ) return 1 ;
160+ return a . localeCompare ( b ) ;
161+ } ) ;
156162 return result . slice ( 0 , MAX_DISPLAYED_BRANCHES ) ;
157- } , [ branches , searchQuery ] ) ;
163+ } , [ branches , searchQuery , defaultBranch ] ) ;
158164
159165 const hasMoreBranches =
160166 branches . length > MAX_DISPLAYED_BRANCHES && ! searchQuery ;
You can’t perform that action at this time.
0 commit comments