mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
In dev with Cache Components, navigating via a `<Link prefetch={true}>`
to a route that hasn't opted into Partial Prefetching logs a warning,
since the full prefetch pulls in dynamic data and defeats the
static/dynamic split.
`instant = false` is the explicit API for opting a route out of this
validation, so it should silence the warning. Previously it didn't: an
`instant = false` segment set no prefetch hint at all, so the warning
still fired.
Add a `SubtreeHasInstantFalse` PrefetchHint, set on any segment that
exports `instant = false` and propagated up to the root (mirroring
`SubtreeHasPartialPrefetching`). The dev warning now skips routes where
this bit is present anywhere on the target subtree.
This is warning-only and kept separate from the existing
`PrefetchDisabled` bit, which feeds `StaticPrefetchDisabled` and would
change actual prefetch behavior.
21 lines
567 B
TypeScript
21 lines
567 B
TypeScript
import { Suspense } from 'react'
|
|
import { connection } from 'next/server'
|
|
|
|
// No config on the page itself — the `instant = false` opt-out comes from the
|
|
// parent layout and should still suppress the warning.
|
|
export default function Page() {
|
|
return (
|
|
<main>
|
|
<div id="static-content">Layout-instant-false static</div>
|
|
<Suspense fallback={<div>Loading dynamic...</div>}>
|
|
<Dynamic />
|
|
</Suspense>
|
|
</main>
|
|
)
|
|
}
|
|
|
|
async function Dynamic() {
|
|
await connection()
|
|
return <div id="dynamic-content">Layout-instant-false dynamic</div>
|
|
}
|