-
Notifications
You must be signed in to change notification settings - Fork 168
🐛(layout): Update parameter parsing in layout components to await params #1572
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
Conversation
fix following warning: ``` Error: Route "/app/projects/[projectId]/ref/[branchOrCommit]/schema-poc" used `params.projectId`. `params` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis at Layout (webpack-internal:/(rsc)/app/(app)/app/(with-project-and-branch)/projects/[projectId]/ref/[branchOrCommit]/app/(app)/app/(with-project-and-branch)/projects/[projectId]/ref/[branchOrCommit]/layout.tsx:14:23) at Object.apply (webpack-internal:/(rsc)/app/(app)/app/(with-project-and-branch)/projects/[projectId]/ref/[branchOrCommit]/sentry-wrapper-module:44:9) 12 | 13 | export default async function Layout({ params, children }: LayoutProps) { > 14 | const parsedParams = v.safeParse(paramsSchema, params) | ^ 15 | if (!parsedParams.success) { 16 | // TODO: Reconsider the display when parse fails 17 | return children ```
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Updates to Preview Branch (fix-layout-props) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
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.
LGTM!
Issue
Why is this change needed?
NextJS warns about using
params
without awaiting it first. This PR fixes the warning by properly awaiting the params object before accessing its properties.The following warning was shown:
What would you like reviewers to focus on?
Testing Verification
What was done
🤖 Generated by PR Agent at f52bbaf
params
in layout and page componentsDetailed Changes
layout.tsx
Await params before parsing in project layout
frontend/apps/app/app/(app)/app/(with-project)/projects/[projectId]/layout.tsx
params
before parsing in layout componentlayout.tsx
Await params before parsing in branch layout
frontend/apps/app/app/(app)/app/(with-project-and-branch)/projects/[projectId]/ref/[branchOrCommit]/layout.tsx
params
before parsing in layout componentpage.tsx
Await params before parsing in branch page
frontend/apps/app/app/(app)/app/(with-project-and-branch)/projects/[projectId]/ref/[branchOrCommit]/page.tsx
params
before parsing in page componentAdditional Notes
None