next.js
65db12fe - [Segment Cache] Support <Link prefetch={true}> (#74172)

Commit
1 year ago
[Segment Cache] Support <Link prefetch={true}> (#74172) This implements support in the Segment Cache for "full" link prefetches, typically initiated by passing `prefetch={true}` to a `<Link>`. The goal of a full prefetch is to request all the data needed for a navigation, both static and dynamic, so that once the navigation occurs, the router does not need to fetch any additional data. So, a full prefetch implicitly instructs the client cache to treat the response as static, even the dynamic data. The implementation is largely the same as what we do to support non-PPR-enabled routes — a request tree is sent to the server describing which segments are already cached and which ones need to be rendered. While constructing the request tree, if all the segments are already in the client cache, the request can be skipped entirely. The main difference is that a full prefetch will only reuse a cached segment entry if it does not contain any dynamic holes.
Author
Parents
Loading