Files
Josh StoryandGitHub a7d1573391 Support more prefetch configuration options (#92859)
"auto" mode is the default. It does not need to be explicitly exported
"force-" modes suggest overriding framework heuristics "force-disabled"
disables prefetching for this segment "force-static" forces any
prefetching of this segment to be static "force-runtime" forces any
prefetching of this segment to do runtime prefetching

It's worth noting that when runtime prefetching we fetch the necessary
segment and all child segments in a single request. This means that a
deeper segment might specify disabled or static and still get
conditionally rendered as a runtime prefetch. This was already the
behavior of runtime prefetching and not changing in this PR just
something to call out since it may be confusing to folks trying to
understand how the implementation of prefetching actually work
2026-04-17 09:28:54 -07:00

30 lines
865 B
TypeScript

// This layout has prefetching disabled because it performs uncached dynamic
// I/O (connection()). Static parents above it should be able to inline through
// it and into the static child below, because this layout acts as a transparent
// pass-through — its slot in the bundle is null but the chain isn't broken.
import { ReactNode, Suspense } from 'react'
import { connection } from 'next/server'
export const unstable_instant = false
export const unstable_prefetch = 'force-disabled'
async function DynamicContent() {
await connection()
return <p id="layout-instant-false-passthrough">Dynamic layout</p>
}
export default function InstantFalsePassthroughLayout({
children,
}: {
children: ReactNode
}) {
return (
<div>
<Suspense fallback={<p>Loading...</p>}>
<DynamicContent />
</Suspense>
{children}
</div>
)
}