-
-
Notifications
You must be signed in to change notification settings - Fork 88
fix: immediately show 'View Project' after launch (closes #158) #165
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
WalkthroughThe changes introduce an Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ProjectDescription
participant ActionButtons
participant LaunchProjectDialog
participant API
User->>ProjectDescription: Visit project page
ProjectDescription->>API: Fetch launch data for project
API-->>ProjectDescription: Return launch status
ProjectDescription->>ActionButtons: Pass isAlreadyLaunched prop
ActionButtons->>LaunchProjectDialog: Pass isAlreadyLaunched prop
User->>LaunchProjectDialog: Open dialog
alt Project already launched
LaunchProjectDialog->>User: Show "View Project" button
else Not launched
LaunchProjectDialog->>User: Show launch form/button
User->>LaunchProjectDialog: Submit launch
LaunchProjectDialog->>API: Launch project mutation
API-->>LaunchProjectDialog: Confirm launch
LaunchProjectDialog->>User: Show "View Project" button
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ 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 (
|
|
@hemanth-1321 is attempting to deploy a commit to the ossdotnow Team on Vercel. A member of the Team first needs to authorize it. |
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: 0
🧹 Nitpick comments (1)
apps/web/app/(public)/(projects)/projects/[id]/project-description.tsx (1)
23-27: Add error handling for the launch data query.The launch data fetching logic is well-implemented, but consider adding error handling and potentially optimizing the query execution.
const trpc = useTRPC(); - const { data: launchData, isLoading: launchLoading } = useQuery( - trpc.launches.getLaunchByProjectId.queryOptions({ projectId: project.id }) - ); + const { data: launchData, isLoading: launchLoading, error } = useQuery({ + ...trpc.launches.getLaunchByProjectId.queryOptions({ projectId: project.id }), + enabled: isOwner, // Only fetch for owners to optimize performance + }); const isAlreadyLaunched = !!launchData;This optimization prevents unnecessary API calls for non-owners and adds error state for better debugging.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/web/app/(public)/(projects)/projects/[id]/project-description.tsx(5 hunks)apps/web/components/project/launch-project-dialog.tsx(6 hunks)packages/api/src/routers/launches.ts(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
packages/api/src/routers/launches.ts (3)
packages/api/src/trpc.ts (1)
protectedProcedure(40-52)packages/db/src/schema/projects.ts (1)
project(16-64)packages/db/src/schema/project-launches.ts (1)
projectLaunch(5-29)
apps/web/app/(public)/(projects)/projects/[id]/project-description.tsx (2)
packages/db/src/schema/projects.ts (1)
project(16-64)packages/api/src/driver/types.ts (2)
ProjectWithRelations(26-72)ProjectData(5-25)
apps/web/components/project/launch-project-dialog.tsx (2)
packages/db/src/seed/create-fixture.ts (1)
data(13-27)packages/ui/src/components/button.tsx (1)
Button(56-56)
🔇 Additional comments (8)
packages/api/src/routers/launches.ts (1)
573-628: LGTM: Formatting improvements without functional changes.The
launchProjectmutation logic remains unchanged - all validation checks, error handling, and business rules are preserved. The reformatting improves readability while maintaining API compatibility for the frontend launch state tracking changes.apps/web/app/(public)/(projects)/projects/[id]/project-description.tsx (3)
11-12: LGTM: Proper imports for React Query integration.The imports are correctly added to support the launch state fetching functionality.
73-73: LGTM: Proper prop threading.The
isAlreadyLaunchedprop is correctly passed to the ActionButtons component to enable launch state awareness.
230-230: LGTM: Clean prop interface updates.The prop signatures are properly updated to include the optional
isAlreadyLaunchedboolean, maintaining backward compatibility while enabling the new functionality.Also applies to: 236-236, 257-257
apps/web/components/project/launch-project-dialog.tsx (4)
34-34: LGTM: Simplified validation schema.Removing the explicit error messages while keeping the validation constraints is a clean simplification. The form will still show appropriate validation feedback.
44-44: LGTM: Proper launch state integration.The new
isAlreadyLaunchedprop andhasLaunchedstate are correctly implemented. Initializing the state from the prop ensures the component reflects the current launch status on mount.Also applies to: 55-55, 59-59
104-104: LGTM: Key fix for immediate UI update.Setting
hasLaunchedto true on successful launch is the core fix that eliminates the need for manual page refresh. This directly addresses the issue described in the PR objectives.
242-262: LGTM: Clean conditional rendering logic.The conditional rendering properly handles all three states:
- Already launched → Show "View Project" button
- Private repository → Show private repo dialog
- Public repository → Show launch dialog
The implementation correctly fixes the original UI issue.
Consider whether opening the project view in a new tab is the desired UX behavior, or if it should navigate in the same tab.
ahmetskilinc
left a comment
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.
one comment
|
@cursor run |
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.
| }: LaunchProjectDialogProps) { | ||
| const [open, setOpen] = useState(false); | ||
| const [privateRepoDialogOpen, setPrivateRepoDialogOpen] = useState(false); | ||
| const [hasLaunched, setHasLaunched] = useState(isAlreadyLaunched ?? false); |
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: State Initialization Fails to Sync with Prop
The hasLaunched state is initialized once from the isAlreadyLaunched prop using useState. Because useState's initializer only runs on the initial render, hasLaunched will not update if the isAlreadyLaunched prop changes later (e.g., when project data loads). This prevents the "View Project" button from appearing for already-launched projects until a new launch or a page refresh. The hasLaunched state should be kept in sync with the isAlreadyLaunched prop, for example, by using useEffect.
Fix: Launched project still shows "Launch" button (#158)
Summary
This fixes the UI not reflecting the launched state immediately.
Fix Details
hasLaunched) that updates immediately on successful mutation.🔗 Related Issue
Closes #158
Screencast.from.2025-07-25.19-44-57.webm
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Improvements