next.js
next.js copied to clipboard
cache() not work when upgrade from [email protected] to next@^13.0.2
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.4.0: Mon Feb 21 20:36:53 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T8101 Binaries: Node: 16.13.1 npm: 8.14.0 Yarn: 1.22.17 pnpm: 7.15.0 Relevant packages: next: 13.0.3 eslint-config-next: 13.0.0 react: 18.2.0 react-dom: 18.2.0
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
All function wrapped by cache
work fine on next version 13.0.0, after upgrade from version 13.0, function use from both request in layout and page are two separate request.
Expected Behavior
response for same request cached when use cache
Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster
no link
To Reproduce
- Create function wrapped by
cache
and put log inside. - use function wrapped by
cache
more than one in server component. - so many function called, as many log print
I'm seeing the same with next 13.0.3 and react 18.2.0.
Locking Next to version 13.0.0 and 13.0.1 works, 13.0.2 and up seem not to cache any of my server side fetches.
https://codesandbox.io/p/sandbox/romantic-oskar-5scorz
Here is a basic example using next 13.0.2, check the output console. When loading the home page, the api console log is logged twice.
I think this is fixed in 13.0.6, can someone help verify?
I think this is fixed in 13.0.6, can someone help verify?
Works for:
Operating System: Win10
Node: 16.13.0
npm: 8.5.1
Yarn: 1.22.17
pnpm: 7.16.1
Relevant packages:
next: 13.0.6
eslint-config-next: 13.0.4
react: 18.2.0
react-dom: 18.2.0