mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #450] [MERGED] refactor: phase 1/2 unify per-request ALS into a shared request context #580
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#580
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/450
Author: @Divkix
Created: 3/11/2026
Status: ✅ Merged
Merged: 3/13/2026
Merged by: @james-elicx
Base:
main← Head:worktree-refactor/unified-als-request-context📝 Commits (10+)
31f0065refactor: consolidate 5 nested ALS scopes into unified request context3d81a10test: update entry-templates snapshots for unified ALS contextbd5a8c0test: update app router waitUntil assertiond708201refactor: unify request ALS across router flows68ff3edfix: address unified request context review feedback9408a13fix: address unified ALS review feedbackcef7e65fix: address remaining unified ALS review feedbackb8c2c12fix: wrap Pages Router ISR regeneration in unified context266d177Fix dev ISR unified context paritye5dd085Merge remote-tracking branch 'origin/main' into worktree-refactor/unified-als-request-context📊 Changes
26 files changed (+3007 additions, -1787 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-entry.ts(+103 -116)📝
packages/vinext/src/entries/pages-server-entry.ts(+114 -76)📝
packages/vinext/src/index.ts(+1 -0)📝
packages/vinext/src/server/app-router-entry.ts(+1 -1)📝
packages/vinext/src/server/dev-server.ts(+677 -692)📝
packages/vinext/src/shims/cache-runtime.ts(+28 -7)📝
packages/vinext/src/shims/cache.ts(+15 -7)📝
packages/vinext/src/shims/fetch-cache.ts(+26 -1)📝
packages/vinext/src/shims/head-state.ts(+16 -7)📝
packages/vinext/src/shims/headers.ts(+28 -31)📝
packages/vinext/src/shims/i18n-state.ts(+20 -12)📝
packages/vinext/src/shims/navigation-state.ts(+40 -14)📝
packages/vinext/src/shims/request-context.ts(+13 -0)➕
packages/vinext/src/shims/request-state-types.ts(+10 -0)📝
packages/vinext/src/shims/router-state.ts(+17 -9)➕
packages/vinext/src/shims/unified-request-context.ts(+170 -0)📝
tests/__snapshots__/entry-templates.test.ts.snap(+773 -810)📝
tests/app-router.test.ts(+7 -2)📝
tests/entry-templates.test.ts(+64 -0)📝
tests/fetch-cache.test.ts(+32 -0)...and 6 more files
📄 Description
Summary
UnifiedRequestContextbacked by oneAsyncLocalStorageinstanceDepends on: #432, #433, #434, #435, #436, #442
Closes #451
Follow-up tracked in #478
Included In This PR
shims/unified-request-context.tsshims/headers.ts_getState(), unified-aware wrapper semanticsshims/navigation-state.ts_getState(), unified-aware wrapper semanticsshims/cache.tsshims/cache-runtime.tsshims/fetch-cache.tsensureFetchPatch()shims/request-context.tsshims/router-state.tsshims/head-state.tsserver/dev-server.tsentries/pages-server-entry.tsentries/app-rsc-entry.tstests/unified-request-context.test.tsDeferred To #478
#478is an umbrella follow-up issue and may span more than one PR.The first follow-up PR should focus on:
renderPage()cacheContextStorageand_unstableCacheAlsFallback cleanup remains conditional and should only happen if those tests/validation show the standalone paths are truly unnecessary.
What Is Intentionally Still Separate
cacheContextStorageincache-runtime.ts: per-cache-call ALS, not per-request_unstableCacheAlsincache.ts: per-call scope forunstable_cache()Test Plan
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.