-
-
Notifications
You must be signed in to change notification settings - Fork 88
project page url update #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
- Updated the project card link to dynamically generate based on the git host (GitHub or GitLab). - Removed unused markdown content, project description, and project page components to streamline the codebase. - Added a new API endpoint to fetch project details by repository for better integration.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
""" WalkthroughThis change refactors project page routing and data fetching to use provider, organization, and repository identifiers instead of a single project ID. It introduces a fallback mechanism for projects not present in the database by synthesizing a virtual project object, updates UI components and queries accordingly, and adds a new API endpoint for fetching projects by repo details. Additionally, debug logging is removed from GitHub and GitLab drivers, and project link URLs are updated to use provider/org/repo paths. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant WebApp
participant API
participant Database
User->>WebApp: Navigate to /projects/{provider}/{org}/{repo}
WebApp->>API: getProjectByRepo(provider, org, repo)
API->>Database: Query project by provider/org/repo
Database-->>API: Project or null
API-->>WebApp: Project data or null
alt Project not in database
WebApp->>WebApp: Construct virtual project object from repo data
end
WebApp->>API: Fetch additional repo data (issues, PRs, readme, etc.)
API-->>WebApp: Repo data
WebApp->>User: Render ProjectPage with real or virtual project data
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/project-description.tsxOops! Something went wrong! :( ESLint: 9.32.0 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by apps/web/app/(public)/launches/[id]/components/launch-sidebar.tsxOops! Something went wrong! :( ESLint: 9.32.0 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bugbot free trial expires on July 29, 2025
Learn more in the Cursor dashboard.
apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/project-description.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (1)
packages/api/src/driver/github.ts (1)
857-859: Remove unnecessary TODO commentThe error is already being properly handled by logging and re-throwing as a TRPCError. The TODO comment should be removed.
} catch (error) { - // TODO: handle error console.error('Error fetching GitHub contributors:', error);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/page.tsx(1 hunks)apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/project-description.tsx(4 hunks)apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/project-page.tsx(19 hunks)apps/web/app/(public)/(projects)/projects/[id]/page.tsx(0 hunks)apps/web/app/(public)/(projects)/projects/project-card.tsx(2 hunks)packages/api/src/driver/github.ts(3 hunks)packages/api/src/driver/gitlab.ts(1 hunks)packages/api/src/routers/projects.ts(1 hunks)
💤 Files with no reviewable changes (1)
- apps/web/app/(public)/(projects)/projects/[id]/page.tsx
🧰 Additional context used
🧬 Code Graph Analysis (2)
apps/web/app/(public)/(projects)/projects/project-card.tsx (2)
packages/db/src/schema/projects.ts (1)
project(16-64)packages/ui/src/components/link.tsx (1)
Link(17-44)
apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/page.tsx (1)
apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/project-page.tsx (1)
ProjectPage(172-1094)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Cursor Bugbot
🔇 Additional comments (10)
packages/api/src/routers/projects.ts (1)
486-513: LGTM! Well-implemented new endpoint for provider-based project lookup.The
getProjectByRepoprocedure correctly handles the new routing structure by:
- Properly normalizing provider shorthand (
gh→github,gl→gitlab)- Querying by
gitHostand concatenated repository path format- Including all necessary relations for the frontend
- Returning
nullfor non-existent projects to support fallback logicapps/web/app/(public)/(projects)/[provider]/[org]/[repo]/page.tsx (1)
3-11: LGTM! Clean implementation following Next.js App Router conventions.The component correctly:
- Handles Promise-based params for App Router
- Extracts route parameters and maps them appropriately
- Maintains clear separation of concerns by delegating to
ProjectPagepackages/api/src/driver/gitlab.ts (1)
658-664: Good improvement to error logging consistency.The changes appropriately:
- Replace
console.logwithconsole.errorfor error scenarios- Add TODO comments indicating future error handling improvements
- Maintain existing functionality while improving error visibility
apps/web/app/(public)/(projects)/projects/project-card.tsx (2)
59-76: Minor JSX reformatting looks fine.The reordering of CSS classes and structure maintains the same functionality while slightly improving readability.
30-33: URL construction & data format confirmedVerified that all sample
gitRepoUrlvalues inpackages/db/src/seed/fixtures/projects.tsuse the expectedorg/repoformat (e.g. “facebook/react”, “vuejs/vue”, etc.). The provider normalization (github → gh,gitlab → gl) combined withconst href = `/${normalizedProvider}/${project.gitRepoUrl}`;correctly aligns with the
[provider]/[org]/[repo]routing. No changes required.apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/project-description.tsx (1)
16-21: Good implementation of conditional rendering for virtual projects.The
isNotInDatabaseprop is properly integrated to hide database-specific elements (status badges, project ticks, social links) when displaying repositories that aren't yet persisted. This aligns well with the fallback mechanism for projects not in the database.Also applies to: 51-53, 127-129
apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/project-page.tsx (4)
24-24: Good refactoring of import pathMoving ProjectErrorPage to a shared location improves code reusability.
158-170: Well-implemented hook refactoringThe hook properly handles the new parameter structure and introduces the
isNotInDatabaseflag for distinguishing between errors and non-existent projects.
381-383: Excellent error handling logicThe conditional error display based on
isNotInDatabaseproperly supports the virtual project feature while still catching real errors.
429-440: Well-structured conditional renderingThe UI properly adapts based on database presence, showing appropriate messages and hiding database-dependent features for virtual projects.
Also applies to: 1021-1038
apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/project-description.tsx
Outdated
Show resolved
Hide resolved
apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/project-page.tsx
Outdated
Show resolved
Hide resolved
| const pullRequestsCount = repoStats?.pullRequestsCount || 0; | ||
|
|
||
| const provider = project.gitHost === 'github' ? 'gh' : 'gl'; | ||
| const href = `/${provider}/${repoData?.owner.login}/${repoData?.name}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Malformed Project Links in Sidebar
The project link in launch-sidebar.tsx is malformed due to two issues: inconsistent provider normalization that defaults to 'gl' for non-GitHub hosts (even if null/undefined), and the use of potentially undefined repoData?.owner.login and repoData?.name before repoQuery has loaded, leading to URLs like /gh/undefined/undefined.
| const normalizedProvider = | ||
| project.gitHost === 'github' ? 'gh' : project.gitHost === 'gitlab' ? 'gl' : project.gitHost; | ||
|
|
||
| const href = `/${normalizedProvider}/${project.gitRepoUrl}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Git URL Handling Causes Frontend and Backend Issues
The project.gitRepoUrl field is incorrectly assumed to contain only the 'owner/repo' portion of a repository identifier, while it actually stores full URLs. This leads to two issues:
- Frontend: Project card links are malformed due to direct concatenation of the full URL.
- Backend: The new
getProjectByRepoAPI's database query compares the fullgitRepoUrlwith an 'org/repo' string, causing it to always fail and return no results.
Locations (2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/project-description.tsx(3 hunks)apps/web/app/(public)/launches/[id]/components/launch-sidebar.tsx(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/project-description.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/web/app/(public)/launches/[id]/components/launch-sidebar.tsx (2)
packages/db/src/schema/projects.ts (1)
project(16-64)packages/ui/src/components/link.tsx (1)
Link(17-44)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Cursor Bugbot
🔇 Additional comments (2)
apps/web/app/(public)/launches/[id]/components/launch-sidebar.tsx (2)
13-13: LGTM: Import reordering looks good.The import order changes are cosmetic and don't affect functionality.
Also applies to: 16-16
222-222: Dynamic provider/org/repo route is supportedThe dynamic route for
/projects/[provider]/[org]/[repo]exists at
• apps/web/app/(public)/(projects)/[provider]/[org]/[repo]/page.tsxSince the corresponding page component is in place, the
<Link href={href}>will resolve correctly. No further changes needed.
| const provider = project.gitHost === 'github' ? 'gh' : 'gl'; | ||
| const href = `/${provider}/${repoData?.owner.login}/${repoData?.name}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add null safety checks for URL construction.
The URL construction logic could fail if repoData or its nested properties are undefined, potentially creating invalid hrefs or causing runtime errors.
Apply this diff to add proper null safety:
- const provider = project.gitHost === 'github' ? 'gh' : 'gl';
- const href = `/${provider}/${repoData?.owner.login}/${repoData?.name}`;
+ const provider = project.gitHost === 'github' ? 'gh' : 'gl';
+ const href = repoData?.owner?.login && repoData?.name
+ ? `/${provider}/${repoData.owner.login}/${repoData.name}`
+ : `/projects/${projectId}`; // fallback to old URL formatThis ensures the Link component always receives a valid href, falling back to the project ID-based URL if repository data is unavailable.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const provider = project.gitHost === 'github' ? 'gh' : 'gl'; | |
| const href = `/${provider}/${repoData?.owner.login}/${repoData?.name}`; | |
| const provider = project.gitHost === 'github' ? 'gh' : 'gl'; | |
| const href = repoData?.owner?.login && repoData?.name | |
| ? `/${provider}/${repoData.owner.login}/${repoData.name}` | |
| : `/projects/${projectId}`; // fallback to old URL format |
🤖 Prompt for AI Agents
In apps/web/app/(public)/launches/[id]/components/launch-sidebar.tsx around
lines 105 to 106, the URL construction uses repoData and its nested properties
without null checks, risking runtime errors if repoData is undefined. Fix this
by adding null safety checks to verify repoData and its nested properties exist
before accessing them; if they do not, fall back to a safe default URL using the
project ID. This ensures the href is always valid and prevents errors.
Summary by CodeRabbit
New Features
Bug Fixes
Chores