next.js
next.js copied to clipboard
fetch() gets revalidates, ignoring cache settings. Next.js 13
Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:05 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8101
Binaries:
Node: 16.18.0
npm: 8.5.2
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 13.0.0
eslint-config-next: 13.0.0
react: 18.2.0
react-dom: 18.2.0
What browser are you using? (if relevant)
Chrome 106.0.5249.119
How are you deploying your application? (if relevant)
next start
Describe the Bug
Multiple fetches in the same server component get revalidated whenever any one of them revalidates, whether it's static or dynamic.
For example, if a static fetch(cache: 'force-cache') and a dynamic fetch(cache: 'no-cache') are in the same server component, whenever a dynamic fetch revalidates, the static fetch also gets revalidated.
Expected Behavior
Static data fetch should not be revalidated.
Link to reproduction
https://github.com/plastic041/next-13-fetch-reproduce
To Reproduce
-
npm install && npm run build && npm run start - open
localhost:3000 - wait more than 3 seconds(
next: { revalidate: 3 }) - static and dynamic data shows same time, since they are both revalidated.