[PR #839] [MERGED] feat(app-router): emit per-layout flags in the RSC payload [2/6] #887

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

📋 Pull Request Information

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

Base: mainHead: feat/pr-768-2-layout-flags-payload


📝 Commits (3)

  • 2d513db feat(app-router): emit per-layout flags in the RSC payload
  • 1825a63 fix(app-elements): widen isAppElementsRecord narrowing and drop redundant clone
  • 57c5be3 fix(app-router): clear leaked dynamic usage on layout probe errors

📊 Changes

7 files changed (+612 additions, -5 deletions)

View changed files

📝 packages/vinext/src/entries/app-rsc-entry.ts (+17 -0)
📝 packages/vinext/src/server/app-elements.ts (+73 -2)
📝 packages/vinext/src/server/app-page-render.ts (+17 -3)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+102 -0)
📝 tests/app-elements.test.ts (+141 -0)
📝 tests/app-page-execution.test.ts (+45 -0)
📝 tests/app-page-render.test.ts (+217 -0)

📄 Description

Summary

PR 2 of 6 — restack of #768. Now rebased onto main after #838 merged.

Wires runtime layout classification through renderAppPageLifecycle and attaches the resulting flags as __layoutFlags in the outgoing RSC payload via buildOutgoingAppPayload. Payload-shape helpers (withLayoutFlags, isAppElementsRecord, buildOutgoingAppPayload, AppOutgoingElements) live alongside readAppElementsMetadata so the write and read boundaries sit next to each other.

No filtering yet; the outgoing element is always canonical. Filtering lands in PR 3.

Stack

  1. [1/6] #838 — centralize request-derived page inputs merged
  2. [2/6] this PR — emit per-layout flags in the RSC payload
  3. [3/6] filter skipped layouts from RSC responses and cached reads
  4. [4/6] send X-Vinext-Router-Skip on navigation requests
  5. [5/6] wire build-time layout classification
  6. [6/6] classification reasons sidecar

Test plan

  • tests/app-elements.test.ts (28 tests)
  • tests/app-page-render.test.ts (13 tests)
  • tests/app-page-execution.test.ts (13 tests)
  • tests/entry-templates.test.ts (22 tests, snapshot regenerated)

🔄 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/839 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 4/14/2026 **Status:** ✅ Merged **Merged:** 4/15/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `feat/pr-768-2-layout-flags-payload` --- ### 📝 Commits (3) - [`2d513db`](https://github.com/cloudflare/vinext/commit/2d513db235324b37e84f740c0c5ef60de1edb786) feat(app-router): emit per-layout flags in the RSC payload - [`1825a63`](https://github.com/cloudflare/vinext/commit/1825a63de7b93dfe4e98d702cb7c7d494cc101b7) fix(app-elements): widen isAppElementsRecord narrowing and drop redundant clone - [`57c5be3`](https://github.com/cloudflare/vinext/commit/57c5be3c42aac07486e3ed7158896d15cf28e18d) fix(app-router): clear leaked dynamic usage on layout probe errors ### 📊 Changes **7 files changed** (+612 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+17 -0) 📝 `packages/vinext/src/server/app-elements.ts` (+73 -2) 📝 `packages/vinext/src/server/app-page-render.ts` (+17 -3) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+102 -0) 📝 `tests/app-elements.test.ts` (+141 -0) 📝 `tests/app-page-execution.test.ts` (+45 -0) 📝 `tests/app-page-render.test.ts` (+217 -0) </details> ### 📄 Description ## Summary **PR 2 of 6 — restack of #768.** Now rebased onto `main` after #838 merged. Wires runtime layout classification through `renderAppPageLifecycle` and attaches the resulting flags as `__layoutFlags` in the outgoing RSC payload via `buildOutgoingAppPayload`. Payload-shape helpers (`withLayoutFlags`, `isAppElementsRecord`, `buildOutgoingAppPayload`, `AppOutgoingElements`) live alongside `readAppElementsMetadata` so the write and read boundaries sit next to each other. No filtering yet; the outgoing element is always canonical. Filtering lands in PR 3. ## Stack 1. ~~[1/6] #838 — centralize request-derived page inputs~~ ✅ merged 2. **[2/6] this PR** — emit per-layout flags in the RSC payload 3. [3/6] filter skipped layouts from RSC responses and cached reads 4. [4/6] send X-Vinext-Router-Skip on navigation requests 5. [5/6] wire build-time layout classification 6. [6/6] classification reasons sidecar ## Test plan - [x] `tests/app-elements.test.ts` (28 tests) - [x] `tests/app-page-render.test.ts` (13 tests) - [x] `tests/app-page-execution.test.ts` (13 tests) - [x] `tests/entry-templates.test.ts` (22 tests, snapshot regenerated) --- <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:40 +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#887
No description provided.