@@ -83,32 +83,27 @@ async function searchRepositoryBranches(
8383 repoId : string ,
8484 defaultBranch ?: string
8585) : Promise < Mention [ ] > {
86- try {
87- const response = await graphqlClient . getRepositoryBranches ( repoName , 10 , branchQuery )
86+ const response = await graphqlClient . getRepositoryBranches ( repoName , 10 , branchQuery )
8887
89- if ( isError ( response ) || ! response . repository ) {
90- return [ ]
91- }
92-
93- const { repository } = response
94- const allBranches = repository . branches . nodes . map ( node => node . abbrevName )
95- const repositoryDefaultBranch = repository . defaultBranch ?. abbrevName || defaultBranch
96-
97- // Filter branches client-side with the search query
98- const query = branchQuery . toLowerCase ( )
99- const filteredBranches = allBranches . filter ( branch => branch . toLowerCase ( ) . includes ( query ) )
100-
101- return createBranchMentionsFromData ( {
102- repoName,
103- repoId,
104- defaultBranch : repositoryDefaultBranch ,
105- branches : filteredBranches ,
106- branchQuery,
107- } )
108- } catch ( error ) {
109- // If the search fails, return empty array to fall back to client-side filtering
88+ if ( isError ( response ) || ! response . repository ) {
11089 return [ ]
11190 }
91+
92+ const { repository } = response
93+ const allBranches = repository . branches . nodes . map ( node => node . abbrevName )
94+ const repositoryDefaultBranch = repository . defaultBranch ?. abbrevName || defaultBranch
95+
96+ // Filter branches client-side with the search query
97+ const query = branchQuery . toLowerCase ( )
98+ const filteredBranches = allBranches . filter ( branch => branch . toLowerCase ( ) . includes ( query ) )
99+
100+ return createBranchMentionsFromData ( {
101+ repoName,
102+ repoId,
103+ defaultBranch : repositoryDefaultBranch ,
104+ branches : filteredBranches ,
105+ branchQuery,
106+ } )
112107}
113108
114109/**
@@ -145,6 +140,7 @@ export async function createBranchMentionsFromData(
145140 mentions . push ( {
146141 uri : `${ serverEndpoint . replace ( / \/ $ / , '' ) } /${ repoName } @${ branch } ` ,
147142 title : `@${ branch } ` ,
143+ // needs to be a space to avoid showing the URL in the menu for branches
148144 description : ' ' ,
149145 data : {
150146 repoName,
0 commit comments