[GH-ISSUE #375] feat: support parent parameter in generateMetadata() #84

Closed
opened 2026-05-06 12:37:05 +02:00 by BreizhHardware · 0 comments

Originally created by @james-elicx on GitHub (Mar 9, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/375

Summary

Next.js's generateMetadata() accepts a second parent parameter of type Promise<ResolvedMetadata>, which resolves to the accumulated metadata from ancestor segments. This allows patterns like:

export async function generateMetadata({ params }, parent) {
  const previousImages = (await parent).openGraph?.images || []
  return { openGraph: { images: ['/new-image.jpg', ...previousImages] } }
}

Next.js uses an eager-execution-with-serial-resolution approach: all generateMetadata() calls are kicked off concurrently, but the parent promise for each segment resolves serially from root to leaf.

Current behavior

vinext's resolveModuleMetadata() does not pass a parent argument. Apps using await parent in generateMetadata() receive undefined and will likely throw or produce incorrect metadata.

Expected behavior

generateMetadata() should receive a parent promise that resolves to the merged metadata from all ancestor segments, matching Next.js behavior.

References

Originally created by @james-elicx on GitHub (Mar 9, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/375 ## Summary Next.js's `generateMetadata()` accepts a second `parent` parameter of type `Promise<ResolvedMetadata>`, which resolves to the accumulated metadata from ancestor segments. This allows patterns like: ```ts export async function generateMetadata({ params }, parent) { const previousImages = (await parent).openGraph?.images || [] return { openGraph: { images: ['/new-image.jpg', ...previousImages] } } } ``` Next.js uses an eager-execution-with-serial-resolution approach: all `generateMetadata()` calls are kicked off concurrently, but the `parent` promise for each segment resolves serially from root to leaf. ## Current behavior vinext's `resolveModuleMetadata()` does not pass a `parent` argument. Apps using `await parent` in `generateMetadata()` receive `undefined` and will likely throw or produce incorrect metadata. ## Expected behavior `generateMetadata()` should receive a `parent` promise that resolves to the merged metadata from all ancestor segments, matching Next.js behavior. ## References - [Next.js docs: generateMetadata — parent parameter](https://nextjs.org/docs/app/api-reference/functions/generate-metadata#parameters) - Flagged during review of #372
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#84
No description provided.