mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #805] Add unstable_io shim for next/cache export #176
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#176
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?
Originally created by @github-actions[bot] on GitHub (Apr 9, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/805
Summary
Next.js added a new
unstable_io()export fromnext/cachebehind theexperimental.unstableIOconfig flag. This is a metasyntactic IO boundary that, during prerendering with cache components, returns a hanging promise to prevent execution of code that follows it. In all other contexts it resolves as a fulfilled thenable that React can unwrap synchronously.Upstream
github.com/vercel/next.js@e22dc27d8fWhat changed
unstable_iofromnext/cache(both server and client/browser paths)experimental.unstableIO(boolean, defaultfalse)process.env.__NEXT_UNSTABLE_IOpackages/next/src/server/request/io.tswith behavior varying by work unit type:request: resolves immediately (production) or uses staged rendering (dev)prerender/prerender-client/prerender-runtime: returns a hanging promise to prevent prerendering past the IO boundarycache/unstable-cache/generate-static-params/prerender-legacy: resolves immediatelyexperimental.unstableIOenabledImpact on vinext
vinext shims
next/cacheand needs to addunstable_ioto the shim. Since vinext primarily targets Cloudflare Workers (no prerendering context), the simplest correct implementation is:unstable_ioto thenext/cacheshim exportsexperimental.unstableIOconfig check and throw if not enabled (matching Next.js behavior)This is gated behind an experimental flag and not ready for general use, so this is low priority.
@github-actions[bot] commented on GitHub (Apr 18, 2026):
Update from Next.js canary (2026-04-17):
9f2779e— Remove flag guardingunstable_io: Theexperimental.unstableIOconfig option has been removed entirely.unstable_io()now works without any config flag — the guard that threw'unstable_io() requires the experimental.unstableIO option'has been deleted from both the server (server/request/io.ts) and browser (client/request/io.browser.ts) implementations.When implementing the vinext shim, there's no need to check for a config flag. The function should work unconditionally.