-
Notifications
You must be signed in to change notification settings - Fork 53
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
✨ Add-project-detail-page #855
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
CI Feedback 🧐(Feedback updated until commit a65454b)A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
<form | ||
action={async (formData) => { | ||
const project = await addProject(formData) | ||
router.push(`/app/projects/${project.id}`) | ||
}} | ||
className={styles.form} | ||
> |
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.
In this implementation, I'm using an inline async function as the action handler for the form. However, since addProject is a Server Action, is this approach correct, or should I separate the Server Action into a dedicated function and pass it to action instead? Would love to hear your thoughts on best practices for using Server Actions in this case.
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.
How about performing a page transition within a Server Action?
export const addProject = async (formData: FormData) => {
const projectName = formData.get('projectName') as string
const project = await prisma.project.create({
data: {
name: projectName,
},
})
redirect(`/app/projects/${project.id}`)
}
type PageProps = { | ||
params: Promise<{ | ||
id: string | ||
}> | ||
} |
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.
The build failed due to a type mismatch in PageProps. The params property was expected to be a Promise, but it was originally defined as a plain object { id: string }.
https://github.com/liam-hq/liam/actions/runs/13803523229/job/38610118863
data: { | ||
name: projectName, | ||
}, | ||
}) | ||
|
||
redirect(`/app/projects/${project.id}`) |
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.
Redirect to the project details page after creation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
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.
I only left one nit comment, but it looked good!
const migrationEnabled = await migrationFlag() | ||
|
||
if (!migrationEnabled) { | ||
notFound() | ||
} | ||
|
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.
[nits]
Since the same functionality is implemented in the middleware, I believe that it's no longer necessary to include it in page.tsx.
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.
same comment 🙏
#855 (comment)
Co-authored-by: Hirotaka Miyagi <[email protected]>
Issue
Why is this change needed?
2025-03-11.18.41.01.mov
2025-03-11.18.48.00.mov
What would you like reviewers to focus on?
Testing Verification
What was done
🤖 Generated by PR Agent at 904d2c2
ProjectDetailPage
component for project details.PageProps
type definition and project ID handling.ProjectDetailPage
component.Detailed Changes
page.tsx
Add project detail page with migration check
frontend/apps/app/app/(app)/app/projects/[id]/page.tsx
notFound
if migration is disabled.addProject.ts
Add auto-redirect to project detail after creation
frontend/apps/app/features/projects/actions/addProject.ts
Form.tsx
Update form component for client-side usage
frontend/apps/app/features/projects/pages/NewProjectPage/Form.tsx
addProject
.ProjectDetailPage.tsx
Create ProjectDetailPage component for project details
frontend/apps/app/features/projects/pages/ProjectDetailPage/ProjectDetailPage.tsx
ProjectDetailPage
component to display project details.notFound
for invalid IDs.index.ts
Export ProjectDetailPage component
frontend/apps/app/features/projects/pages/ProjectDetailPage/index.ts
ProjectDetailPage
component for external use.index.ts
Include ProjectDetailPage in exports
frontend/apps/app/features/projects/pages/index.ts
ProjectDetailPage
to the exports.ProjectDetailPage.module.css
Add styles for ProjectDetailPage component
frontend/apps/app/features/projects/pages/ProjectDetailPage/ProjectDetailPage.module.css
ProjectDetailPage
component.Additional Notes