mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #972] unstable_io() does not hang during prerendering #210
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#210
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 @Divkix on GitHub (Apr 29, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/972
Summary
During prerendering contexts (static export,
--prerender-all, TPR),unstable_io()should return a hanging promise to prevent execution past the IO boundary. Currently, vinext always returns a resolved promise, matching the browser/client implementation but not the server-side behavior.Expected behavior (Next.js)
In Next.js's server-side implementation (
packages/next/src/server/request/io.ts),unstable_io()branches onworkUnitStore.type:prerender/prerender-client/prerender-runtime→ returnsmakeHangingPromise(renderSignal, route, reason)— stalls prerendering past the IO boundaryrequest→ resolves immediatelycache/private-cache/unstable-cache/generate-static-params/prerender-legacy→ resolves immediatelyCurrent vinext behavior
packages/vinext/src/shims/cache.tsalways returns_resolvedIOPromise— a singleton resolved promise. There is no prerendering context awareness.Gap
vinext does not yet implement:
workUnitAsyncStorage/workAsyncStoragewith type tracking (request,prerender,cache, etc.)makeHangingPromise/renderSignal— the mechanism to stall prerenderingRenderStageenum /staged-renderingmoduleppr-removed-errorhandlingThese are foundational pieces needed not just for
unstable_io()but for full prerendering and PPR parity.Related PRs
unstable_io()APIpackages/next/src/server/request/io.tspackages/next/src/client/request/io.browser.ts