mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #768] [CLOSED] feat: X-Vinext-Router-Skip header optimization for static layouts #830
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#830
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/768
Author: @NathanDrake2406
Created: 4/3/2026
Status: ❌ Closed
Base:
main← Head:feat/layout-persistence-pr-7-skip-header📝 Commits (4)
ecc25d6feat: X-Vinext-Router-Skip header optimization for static layouts2e0e0adtest: refresh entry template snapshotsc68aa2afix: disable unsafe app-router skip filteringd63f29afix: restore mounted-slot requests and tighten codegen seams📊 Changes
24 files changed (+4337 additions, -245 deletions)
View changed files
➕
packages/vinext/src/build/layout-classification-types.ts(+50 -0)📝
packages/vinext/src/build/layout-classification.ts(+48 -10)📝
packages/vinext/src/build/report.ts(+31 -15)➕
packages/vinext/src/build/route-classification-manifest.ts(+234 -0)📝
packages/vinext/src/entries/app-rsc-entry.ts(+114 -23)📝
packages/vinext/src/index.ts(+173 -0)📝
packages/vinext/src/server/app-browser-entry.ts(+6 -12)📝
packages/vinext/src/server/app-elements.ts(+165 -2)📝
packages/vinext/src/server/app-page-cache.ts(+10 -1)📝
packages/vinext/src/server/app-page-execution.ts(+34 -0)📝
packages/vinext/src/server/app-page-render.ts(+35 -4)➕
packages/vinext/src/server/app-page-skip-filter.ts(+333 -0)📝
packages/vinext/src/shims/error-boundary.tsx(+3 -2)📝
tests/__snapshots__/entry-templates.test.ts.snap(+732 -132)📝
tests/app-elements.test.ts(+266 -0)📝
tests/app-page-cache.test.ts(+156 -0)📝
tests/app-page-execution.test.ts(+134 -0)📝
tests/app-page-render.test.ts(+585 -0)➕
tests/app-page-skip-filter.test.ts(+486 -0)📝
tests/app-router.test.ts(+21 -0)...and 4 more files
📄 Description
Summary
Implements the skip header optimization that lets the client tell the server "I already have these static layouts cached," and the server omits them from the RSC payload. This reduces bandwidth and parse time for navigation between routes that share static layouts.
parseSkipHeader(filters tolayout:*entries only),buildSkipHeaderValue(emits only static IDs),X_VINEXT_ROUTER_SKIP_HEADERconstantLayoutClassificationOptionsthroughrenderAppPageLifecycle→ probe →__layoutFlagsinjection into the RSC elements payloadcreateRscRequestHeadersincludesX-Vinext-Router-Skipwith static layout IDs from the current router state. Only sent on navigation RSC fetches (not SSR, HMR, server actions, or prefetches)app-rsc-entry.tsparses the skip header, wires classification withgetLayoutId+runWithIsolatedDynamicScope, passes skip set to render lifecycleSafety guarantees
__route,__rootLayout,__interceptionContext,__layoutFlagsare never skippable"d"__layoutFlags= empty flagsTest plan
parseSkipHeader: null, empty, single, comma-separated, whitespace, non-layout filteredbuildSkipHeaderValue: empty → null, all dynamic → null, mix → only static, all static__layoutFlagsinjection: static, dynamic, no classification (backward compat), multiple layoutsvp checkclean: format, lint, types all pass🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.