mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +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.
11 lines
382 B
TypeScript
11 lines
382 B
TypeScript
import { ReactNode } from 'react'
|
|
|
|
// `instant = false` lives on the layout, not the page. The
|
|
// SubtreeHasInstantFalse hint should propagate up from the layout to the root,
|
|
// so a `prefetch={true}` link to a page underneath it should NOT warn.
|
|
export const instant = false
|
|
|
|
export default function Layout({ children }: { children: ReactNode }) {
|
|
return <div>{children}</div>
|
|
}
|