Skip to content
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

docs: updates generateMetadata function signature #54638

Merged
merged 3 commits into from
Aug 27, 2023

Conversation

emiliosheinz
Copy link
Contributor

@emiliosheinz emiliosheinz commented Aug 27, 2023

Change optional arg to non-optional arg of parent in the generateMetadata API function example in oder to avoid the error shown below.

Screenshot 2023-08-27 at 15 23 02

Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

Copy link
Member

@huozhi huozhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parent is always passed as a promise, the right signature should be

export async function generateMetadata(
  { params, searchParams }: Props,
  parent: ResolvingMetadata
): Promise<Metadata> {

You can remove the ? for the 2nd arg parent, and revert the change in the function body

@emiliosheinz emiliosheinz changed the title docs: adds optional chaining to parent call on the generateMetadata docs: updates generateMetadata function signature Aug 27, 2023
@emiliosheinz
Copy link
Contributor Author

parent is always passed as a promise, the right signature should be

export async function generateMetadata(
  { params, searchParams }: Props,
  parent: ResolvingMetadata
): Promise<Metadata> {

You can remove the ? for the 2nd arg parent, and revert the change in the function body

Thank you for the heads up. I just updated the code!

Copy link
Member

@huozhi huozhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ijjk
Copy link
Member

ijjk commented Aug 27, 2023

Allow CI Workflow Run

  • approve CI run for commit: 30e75b5

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@ijjk
Copy link
Member

ijjk commented Aug 27, 2023

Allow CI Workflow Run

  • approve CI run for commit: 30e75b5

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@huozhi huozhi added the CI approved Approve running CI for fork label Aug 27, 2023
@kodiakhq kodiakhq bot merged commit a699c98 into vercel:canary Aug 27, 2023
47 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI approved Approve running CI for fork locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants