next.js
f5af2845 - Add global config to enable Partial Prefetching (#94448)

Commit
26 days ago
Add global config to enable Partial Prefetching (#94448) Adds a global config option called `partialPrefetching` that changes the behavior of `<Link prefetch={true}>`. When Partial Prefetching is enabled, only Cache Components are included in a prefetch response. Dynamic data is omitted. This is the same idea as Partial Prerendering for initial page loads, now applied to client navigations. In the initial Cache Components release, Partial Prefetching was enabled for any Link that did not explicitly set a `prefetch` prop. However, if the `prefetch` prop was set to `true`, then the Link retained the old behavior where the _entire_ page was prefetched, including dynamic data. This was to ease the migration path for existing apps that already relied on dynamic data being included in the prefetch. For new apps that have Cache Components enabled from the start, it's suggested to also enable `partialPrefetching`. This PR also adds a per-segment opt-in: a route segment can set `unstable_prefetch = 'partial'` to enable Partial Prefetching just for that segment, so apps can migrate gradually before enabling it globally. <!-- NEXT_JS_LLM_PR -->
Author
Parents
Loading