feat: add GitHub search for users and repositories#2
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughAdds a combined GitHub search results flow: new githubApi search methods and types, extended Zustand store and navigation for a 'results' view, a client-side ViewSearchResults UI with pagination, routing/header/search UI updates, and documentation/version bumps. ChangesSearch Results Feature
Sequence DiagramsequenceDiagram
participant User
participant ViewSearch
participant useAppStore
participant githubApi
participant ViewSearchResults
User->>ViewSearch: enters query
ViewSearch->>useAppStore: search(query)
useAppStore->>githubApi: searchUsers(query)
useAppStore->>githubApi: searchRepositories(query)
githubApi-->>useAppStore: returns first-page results
useAppStore->>useAppStore: set searchUsersResults, searchReposResults, searchQuery
useAppStore->>ViewSearchResults: navigate to 'results' (state)
ViewSearchResults->>User: render paginated results
🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/github.ts`:
- Around line 159-165: The current code eager-fetches all remaining pages via
Promise.all (remainingPages) which causes bursty GitHub requests; modify the
search to fetch only the first page (keep the initial githubFetch for page=1),
remove the Array.from/Promise.all fan-out, and return the first-page results
along with totalPages/nextPage metadata so callers can request subsequent pages
explicitly; keep references to githubFetch and GitHubSearchResponse<T> so you
can implement an on-demand pager (e.g., a fetchPage(page) helper) that callers
invoke for further pages instead of fetching them all at once.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 42ce9a7f-2b89-4543-8a3e-72a7dc6bd6bb
⛔ Files ignored due to path filters (2)
package-lock.jsonis excluded by!**/package-lock.jsonpublic/avatar-placeholder.svgis excluded by!**/*.svg
📒 Files selected for processing (7)
src/app/api/github/[...path]/route.tssrc/app/page.tsxsrc/components/LayoutHeader.tsxsrc/components/ViewSearch.tsxsrc/components/ViewSearchResults.tsxsrc/lib/github.tssrc/store/useAppStore.ts
Summary
Adds GitHub search functionality — users and repositories can now be searched via a single query, with paginated results displayed in a dedicated
ViewSearchResultscomponent.Changes
API & Data Layer
src/app/api/github/[...path]/route.ts— Added/search/usersand/search/repositoriesto the allowed paths whitelistsrc/lib/github.ts— AddedGitHubSearchUser,GitHubSearchUsersResponse,GitHubSearchReposResponsetypes; implemented a genericsearchAllPages()helper that fetches all pages (up to 1000 results, 100 per page); exposedgithubApi.searchUsers()andgithubApi.searchRepositories()State
src/store/useAppStore.ts— Addedresultsview,searchUsersResults,searchReposResults,searchQuerystate fields; addedsearchtype toHistoryItem; updatedfetchContentto dispatch a combined search when the input is not a repo path; deduplication logic updated accordinglyUI
src/components/ViewSearchResults.tsx(new) — Displays user cards (grid, 10/page) and repository cards (2-column, 10/page) with language badges, star/fork counts, topics, and pagination controlspublic/avatar-placeholder.svg(new) — Fallback image for user avatars on load errorsrc/components/ViewSearch.tsx— Updated placeholder text; changed suggestions to include generic search examples; addedsearchicon type for history itemssrc/components/LayoutHeader.tsx— Resets search results state when navigating homesrc/app/page.tsx— Addedcase "results"to renderViewSearchResultsChores
package-lock.json— Bumped version to0.2.3, addedenginesfield (node >=22.0.0,npm >=10.0.0)Summary by CodeRabbit
New Features
Bug Fixes / Improvements
Documentation