When you select an org with a lot of repos (like gruntwork-test), the repository dropdown only fetches a single page of 100 repos from GET /users/:owner/repos. If the repo you're looking for isn't in that first page, there's no way to find it.
The search box in the dropdown also doesn't help, because it only filters the already-fetched list client-side. It doesn't call the backend with aquery, even though the backend already supports it. The fetchRepos function accepts an optional query parameter, and fetchGitHubRepos in git_clone.go already switches to GitHub's search API when a query is provided. But the frontend never passes the search text through.
Current behavior
- User selects an org
- loadRepos calls fetchRepos(org) with no query
- Backend fetches GET /users/:owner/repos?per_page=100&sort=updated&type=all (single page, max 100 results)
- User types in the repo search box, but it only filters the 100 repos already loaded
- Repos beyond the first page are invisible
Proposed fix
Frontend (GitHubBrowser.tsx):
- Debounce the repo search input and call fetchRepos(org, query) when the user types, so the backend search API is actually used
- For the initial load (no query), paginate by fetching additional pages, similar to how branches/tags already paginate up to 3 pages
Backend (git_clone.go):
- The search path already works (/search/repositories?q=...), but only fetches 30 results. Might want to bump that or add pagination there too for orgs with many similarly-named repos.
- The non-search path (/users/:owner/repos) should paginate. Fetching 2-3 pages of 100 would cover most orgs, matching the pattern already used for branches and tags.
When you select an org with a lot of repos (like gruntwork-test), the repository dropdown only fetches a single page of 100 repos from GET /users/:owner/repos. If the repo you're looking for isn't in that first page, there's no way to find it.
The search box in the dropdown also doesn't help, because it only filters the already-fetched list client-side. It doesn't call the backend with aquery, even though the backend already supports it. The fetchRepos function accepts an optional query parameter, and fetchGitHubRepos in git_clone.go already switches to GitHub's search API when a query is provided. But the frontend never passes the search text through.
Current behavior
Proposed fix
Frontend (GitHubBrowser.tsx):
Backend (git_clone.go):