-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Breaking] Disable automatic fetch caching (#66004)
## Background Previously we introduced automatic caching for `fetch` based on certain heuristics that were a bit tricky to grasp all scenarios. The scenarios we would automatically cache were no dynamic data access before the fetch call e.g. `headers()` or `cookies()`, the fetch call is inside of a dynamic page e.g. `POST` method or `export const revalidate = 0` page and the fetch is a non-`GET` request or has `Authorization` or `Cookie` headers, or the fetch had `cache: 'no-store' | 'no-cache'` or `revalidate: 0`. ## New Behavior By default fetches will no longer automatically be cached. Instead they need to be opted-in to caching via `export const fetchCache = 'default-cache' | 'force-cache',` `next: { revalidate: false or value > 0 }` or `cache: 'force-cache' | 'default-cache'`. When the fetch call is automatically skipping the cache it won't impact the page level ISR cacheability although if a fetch call manually specifies `cache: 'no-store'` or `revalidate: 0` it will still bail from the page being statically generated as it was before. To achieve the previous behavior of automatic fetch caching all that needs to be added is `export const fetchCache = 'default-cache'` in the root layout(s) of your project.
- Loading branch information
Showing
10 changed files
with
168 additions
and
59 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
Oops, something went wrong.