[PR #778] [MERGED] fix: await buildPageElement in server action re-render path #838

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/778
Author: @NathanDrake2406
Created: 4/4/2026
Status: Merged
Merged: 4/4/2026
Merged by: @james-elicx

Base: mainHead: fix/await-build-page-element-action


📝 Commits (1)

  • 8cae9b0 fix: await buildPageElement in server action re-render path

📊 Changes

3 files changed (+24 additions, -7 deletions)

View changed files

📝 packages/vinext/src/entries/app-rsc-entry.ts (+1 -1)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+6 -6)
📝 tests/entry-templates.test.ts (+17 -0)

📄 Description

Summary

  • The server action re-render path in app-rsc-entry.ts was calling buildPageElement() without await, assigning a Promise to element instead of a resolved React element
  • This caused redirect()/notFound() thrown inside generateMetadata() during action re-renders to surface as RSC stream errors rather than propagating to the outer catch handler
  • It also caused getAndClearPendingCookies() to run before page tree construction resolved, missing any cookies set during page building

The fix is a single await on line 1746, aligning the action re-render path with the normal render path which already correctly awaits buildPageElement.

Test plan

  • Added a focused test in tests/entry-templates.test.ts that asserts the generated entry code contains element = await buildPageElement(...) in the action re-render path — verified it fails before the fix and passes after
  • Updated 6 RSC entry snapshots to reflect the await in the generated code
  • pnpm test tests/entry-templates.test.ts — 21/21 tests pass
  • vp check on changed files — no formatting, lint, or type errors

🔄 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/778 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 4/4/2026 **Status:** ✅ Merged **Merged:** 4/4/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/await-build-page-element-action` --- ### 📝 Commits (1) - [`8cae9b0`](https://github.com/cloudflare/vinext/commit/8cae9b03c7af5bcf67fb7a4978d1dc6bb3d9b392) fix: await buildPageElement in server action re-render path ### 📊 Changes **3 files changed** (+24 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+1 -1) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+6 -6) 📝 `tests/entry-templates.test.ts` (+17 -0) </details> ### 📄 Description ## Summary - The server action re-render path in `app-rsc-entry.ts` was calling `buildPageElement()` without `await`, assigning a Promise to `element` instead of a resolved React element - This caused `redirect()`/`notFound()` thrown inside `generateMetadata()` during action re-renders to surface as RSC stream errors rather than propagating to the outer catch handler - It also caused `getAndClearPendingCookies()` to run before page tree construction resolved, missing any cookies set during page building The fix is a single `await` on line 1746, aligning the action re-render path with the normal render path which already correctly awaits `buildPageElement`. ## Test plan - [x] Added a focused test in `tests/entry-templates.test.ts` that asserts the generated entry code contains `element = await buildPageElement(...)` in the action re-render path — verified it fails before the fix and passes after - [x] Updated 6 RSC entry snapshots to reflect the `await` in the generated code - [x] `pnpm test tests/entry-templates.test.ts` — 21/21 tests pass - [x] `vp check` on changed files — no formatting, lint, or type errors --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:10:24 +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#838
No description provided.