next.js
a32dc8e9 - [Segment Cache] Background segment revalidation (#74057)

Commit
350 days ago
[Segment Cache] Background segment revalidation (#74057) This implements background revalidation of partial segment entries in the client Segment Cache. Until this PR, entries were never replaced in the Segment Cache, they were only evicted upon becoming stale, or if the LRU overflowed. But there are cases where we'll want to replace an existing entry with a new one; for example, if the current segment has more dynamic holes than the new one. Most commonly this happens when multiple fetching strategies are mixed within the same app. For example: when a shared layout belongs to both a PPR-enabled route and a non-PPR enabled route, the layout data might be omitted when prefetching the non-PPR enabled route, if it's wrapped in a loading boundary. But that shouldn't prevent it from being included when prefetching the route that has PPR enabled. (*Another example is when a shared layout is prefetched both on viewport entry and also via `<Link prefetch={true}>`. A viewport prefetch will only include the static data, but `prefetch={true}` includes both the static and the dynamic.* *`<Link prefetch={true}>` is not yet implemented by the Segment Cache but it will use a similar background revalidation strategy as the one implemented in this PR.*)
Author
Parents
Loading