-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prerendered pages should use static staleTime (#67868)
### What Prefetches for static pages currently aren't distinguished from dynamic pages insofar as their client router cache TTL is concerned. This meant pre v15, both static and dynamic pages leveraged the 30s cache. In v15, this meant it would refetch the static data every navigation, since we changed the `dynamic` staleTime value to `0`. The only way to force a prefetch to use the static staletime was via `prefetch={true}` on a link (or `router.prefetch`). ### Why The router had no way of distinguishing between static or dynamic responses. The only difference was the RSC payload between the two, since a static response would contain the full tree, and a dynamic response would potentially be short-circuited with `loading.js` or have a fairly minimal response for just basic metadata. ### How This introduces a header the client can leverage to determine if the response is a prerender. If it is, we mark the "auto" prefetch entry as "full" so that it respects the `static` staleTime value (current default is 5min). We use a new header, rather than piggybacking on `x-nextjs-cache` / `x-vercel-cache`, because a static page can technically have a `MISS` status if it's revalidating. Fixes #66513 Closes NDX-65
- Loading branch information
Showing
8 changed files
with
121 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters