[PR #372] [MERGED] perf: parallelise metadata and viewport resolution #519

Closed
opened 2026-05-06 13:08:31 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/372
Author: @james-elicx
Created: 3/9/2026
Status: Merged
Merged: 3/9/2026
Merged by: @james-elicx

Base: mainHead: j-branch-11


📝 Commits (6)

  • 8812ae1 perf: parallelise metadata and viewport resolution
  • 9077108 fix: propagate page generateMetadata errors to error boundary
  • 2b3d082 Merge remote-tracking branch 'origin/main' into fix/metadata-error-propagation
  • 71b5bfc test: update snapshots
  • 622dd58 fix: log layout generateMetadata/generateViewport errors instead of silently swallowing them
  • 4d126e6 regen snaps

📊 Changes

2 files changed (+196 additions, -189 deletions)

View changed files

📝 packages/vinext/src/server/app-dev-server.ts (+28 -27)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+168 -162)

📄 Description

What

Converts sequential await loops for generateMetadata() and generateViewport() resolution into Promise.all, so all layouts' metadata is resolved concurrently rather than one-at-a-time.

Why

For deeply nested App Router layouts that do async I/O in generateMetadata() (KV reads, fetches, DB queries), the old serial approach meant total metadata resolution time was sum(individual times). With Promise.all it becomes max(individual times).

Details

  • Layout metadata errors are caught and logged (console.error) rather than crashing the page — a layout's generateMetadata() failing shouldn't take down the whole render
  • Page generateMetadata() errors are intentionally not swallowed — they propagate to the nearest error.tsx or global-error.tsx boundary, matching Next.js behavior
  • Snapshot updates reflect the parallelisation changes to the entry templates
  • #375 — pre-existing gap: generateMetadata() parent parameter is not yet supported

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/372 **Author:** [@james-elicx](https://github.com/james-elicx) **Created:** 3/9/2026 **Status:** ✅ Merged **Merged:** 3/9/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `j-branch-11` --- ### 📝 Commits (6) - [`8812ae1`](https://github.com/cloudflare/vinext/commit/8812ae143c6ef4c104937f0d9d12d858ec6e8895) perf: parallelise metadata and viewport resolution - [`9077108`](https://github.com/cloudflare/vinext/commit/9077108b775d10f1e690b2bef77986d544102cda) fix: propagate page generateMetadata errors to error boundary - [`2b3d082`](https://github.com/cloudflare/vinext/commit/2b3d0823e017d2d3268afc269d703cbd302f93d1) Merge remote-tracking branch 'origin/main' into fix/metadata-error-propagation - [`71b5bfc`](https://github.com/cloudflare/vinext/commit/71b5bfc5b86f908eb0b3252f27b3d3b53a9b6999) test: update snapshots - [`622dd58`](https://github.com/cloudflare/vinext/commit/622dd585b8aa71411ec7bce4baf623568f183d17) fix: log layout generateMetadata/generateViewport errors instead of silently swallowing them - [`4d126e6`](https://github.com/cloudflare/vinext/commit/4d126e6ec7684ab9aaab4dbbb6560464a15d1ad3) regen snaps ### 📊 Changes **2 files changed** (+196 additions, -189 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/server/app-dev-server.ts` (+28 -27) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+168 -162) </details> ### 📄 Description ## What Converts sequential `await` loops for `generateMetadata()` and `generateViewport()` resolution into `Promise.all`, so all layouts' metadata is resolved concurrently rather than one-at-a-time. ## Why For deeply nested App Router layouts that do async I/O in `generateMetadata()` (KV reads, fetches, DB queries), the old serial approach meant total metadata resolution time was `sum(individual times)`. With `Promise.all` it becomes `max(individual times)`. ## Details - **Layout metadata errors** are caught and logged (`console.error`) rather than crashing the page — a layout's `generateMetadata()` failing shouldn't take down the whole render - **Page `generateMetadata()` errors** are intentionally not swallowed — they propagate to the nearest `error.tsx` or `global-error.tsx` boundary, matching Next.js behavior - Snapshot updates reflect the parallelisation changes to the entry templates ## Related - #375 — pre-existing gap: `generateMetadata()` `parent` parameter is not yet supported --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:08:31 +02:00
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#519
No description provided.