You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Side note: If you skip step 4, I only get one 200 GET request logged on initial page load, although the Next.js logs say two cache misses, whereas I'd expect one cache hit given only one GET request was received?
│ GET http://localhost:9000/index.html 200 in 90ms (cache skip)
│ │ Cache skipped reason: (auto no cache)
│ GET http://localhost:9000/index.html 200 in 56ms (cache skip)
│ │ Cache skipped reason: (auto no cache)
Current vs. Expected behavior
Current behaviour: 2 requests get made to the demo server.
Expected behaviour: 1 request gets made to the demo server, as the documentation at https://nextjs.org/docs/app/building-your-application/caching#data-cache says that fetch requests get cached between generateMetadata and page components. I noticed that cache is manually used in this example: #62162, but the docs suggest this is not necessary.
I have disabled strict mode as well, in case duplicates were coming from that.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.2.0: Fri Nov 15 18:56:27 PST 2024; root:xnu-11215.61.2.501.1~1/RELEASE_ARM64_T8103
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 21.7.1
npm: 10.5.0
Yarn: 1.22.22
pnpm: 9.2.0
Relevant Packages:
next: 14.2.10
eslint-config-next: N/A
react: 18.3.1
react-dom: 18.3.1
typescript: 5.4.5
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Not sure, Documentation, Metadata
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
The text was updated successfully, but these errors were encountered:
I think this may have been around a while. We don't use fetch and have been using a combo of react.cache and unstable_cache to date, but still have 2 requests (it was 4 without it).
I have just explored on canary the use cache directive and have found that does appear to solve the issues we were having however, that's no good for us in production right now
Link to the code that reproduces this issue
https://github.com/steveharrison/nextjs-fetch-caching
To Reproduce
npm run server
andnpm run start
. It will start a server on port 9000.cd nextjs-project
andnpm run dev
.Side note: If you skip step 4, I only get one 200 GET request logged on initial page load, although the Next.js logs say two cache misses, whereas I'd expect one cache hit given only one GET request was received?
Current vs. Expected behavior
Current behaviour: 2 requests get made to the demo server.
Expected behaviour: 1 request gets made to the demo server, as the documentation at https://nextjs.org/docs/app/building-your-application/caching#data-cache says that fetch requests get cached between generateMetadata and page components. I noticed that
cache
is manually used in this example: #62162, but the docs suggest this is not necessary.I have disabled strict mode as well, in case duplicates were coming from that.
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.2.0: Fri Nov 15 18:56:27 PST 2024; root:xnu-11215.61.2.501.1~1/RELEASE_ARM64_T8103 Available memory (MB): 16384 Available CPU cores: 8 Binaries: Node: 21.7.1 npm: 10.5.0 Yarn: 1.22.22 pnpm: 9.2.0 Relevant Packages: next: 14.2.10 eslint-config-next: N/A react: 18.3.1 react-dom: 18.3.1 typescript: 5.4.5 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Not sure, Documentation, Metadata
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: