Files
Andrew ClarkandGitHub c39c7179a4 Suppress prefetch={true} warning when route opts out via instant = false (#95099)
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.
2026-06-24 17:52:22 -04:00

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>
}