Files
next.js/test/e2e/app-dir/segment-cache/staleness/app/page.tsx
Andrew ClarkandGitHub 244fac6eec Decouple route and segment cache lifecycles (#88989)
Based on:

- https://github.com/vercel/next.js/pull/88834

---

Follows from the previous commits that decoupled route stale time from
segment data. Now that routes have their own lifecycle, we can simplify
the implementation: route stale times are always the static constant,
rather than being derived from server-provided values.

Route structure is essentially static — it only changes on deploy. The
exception is rewrites/redirects in middleware or proxy, which can change
routes dynamically based on request state. But we have other strategies
for handling those cases (e.g., route interception headers, cache
invalidation on auth state changes).

This simplification removes the need to thread stale time through
various call sites. The `fulfillRouteCacheEntry` function now computes
the stale time internally from a `now` timestamp parameter, following
the convention used elsewhere in the codebase.
2026-01-28 10:55:39 -05:00

45 lines
1.4 KiB
TypeScript

import { LinkAccordion } from '../components/link-accordion'
export default function Page() {
return (
<>
<p>
This page is used to test various scenarios related to prefetch cache
staleness. In the corresponding e2e test, the links below are prefetched
(by toggling their visibility), time is elapsed, and then prefetched
again to check whether a new network request is made.
</p>
<ul>
<li>
<LinkAccordion href="/stale-2-minutes">
Page with stale time of 2 minutes
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/stale-4-minutes">
Page with stale time of 4 minutes
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/runtime-stale-2-minutes">
Page whose runtime prefetch has a stale time of 2 minutes
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/runtime-stale-4-minutes">
Page whose runtime prefetch has a stale time of 4 minutes
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/dynamic">Page with dynamic data</LinkAccordion>
</li>
<li>
<LinkAccordion href="/seconds">
Page with cached data with <code>cacheLife("seconds")</code>
</LinkAccordion>
</li>
</ul>
</>
)
}