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
Summary
Next.js's
generateMetadata()accepts a secondparentparameter of typePromise<ResolvedMetadata>, which resolves to the accumulated metadata from ancestor segments. This allows patterns like:Next.js uses an eager-execution-with-serial-resolution approach: all
generateMetadata()calls are kicked off concurrently, but theparentpromise for each segment resolves serially from root to leaf.Current behavior
vinext's
resolveModuleMetadata()does not pass aparentargument. Apps usingawait parentingenerateMetadata()receiveundefinedand will likely throw or produce incorrect metadata.Expected behavior
generateMetadata()should receive aparentpromise that resolves to the merged metadata from all ancestor segments, matching Next.js behavior.References