mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #849] Support unstable_prefetch route segment config #184
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#184
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 15, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/849
Next.js Change
Next.js added a new
unstable_prefetchroute segment config option, decoupled fromunstable_instant.Commit:
github.com/vercel/next.js@ac6d9932a6PR: #92754
What Changed
A new route segment config export
unstable_prefetchwas added to App Router pages/layouts:Key details:
'static' | 'runtime'—'static'is a no-op (default),'runtime'enables runtime prefetchingcacheComponents: trueinnext.config.js— throws a build error otherwise"use client"moduleunstable_instant— previously, runtime prefetching was configured viaunstable_instant: { prefetch: 'runtime' }. Nowunstable_prefetchcontrols prefetching independently, andunstable_instantis purely for instant validationcreate-component-tree.tsxnow readsunstable_prefetchinstead ofunstable_instant.prefetchto determinehasRuntimePrefetchImpact on vinext
vinext's route segment config parsing (
routing/app-router.ts,get-page-static-infoequivalent) should recognizeunstable_prefetchas a valid export to avoid spurious warnings. The actual runtime prefetching behavior is not something vinext needs to implement immediately (it's experimental and tied tocacheComponents), but the config should be parsed and acknowledged.Files Changed (non-test)
packages/next/src/build/segment-config/app/app-segment-config.ts— addedPrefetchSchema,Prefetchtype, andunstable_prefetchto the schemapackages/next/src/build/analysis/get-page-static-info.ts— added validation (requirescacheComponents, disallows"use client")packages/next/src/server/app-render/create-component-tree.tsx— readsunstable_prefetchinstead ofunstable_instant.prefetchcrates/next-core/src/segment_config.rs— Turbopack-side parsing of the new config@github-actions[bot] commented on GitHub (Apr 18, 2026):
Update from Next.js canary (2026-04-17):
Two commits changed the
unstable_prefetchsegment config API:a7d1573— Support more prefetch configuration options: The valid values changed from'static' | 'runtime'to'auto' | 'force-disabled' | 'force-static' | 'force-runtime'. ThePrefetchDisabledhint moved frominstant === falsetoprefetch === 'force-disabled'.'auto'is the default and does not need to be explicitly exported.1931877— Remove prefetch from instant config: Theprefetchproperty was removed from theinstantexport type. Prefetching is now controlled exclusively via theprefetchexport.When implementing this, the
Prefetchtype should use the new values, and the segment config parser needs to validate against'auto' | 'force-disabled' | 'force-static' | 'force-runtime'.