Docs here state that:
You can use React cache to memoize data requests during a React render pass. For example, although the getItem function is called in both layout and page, only one query will be made to the database:
But on this Sandbox, you can see in the logs that it gets called twice.
Tested in both Vercel deployment and locally.
To Reproduce
- Open the sandbox above
- Clear the terminal
- Check the logs
- Refresh the embedded browser
getItem
will be logged twice
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023
Binaries:
Node: 20.12.0
npm: 10.5.0
Yarn: 1.22.19
pnpm: 8.15.6
Relevant Packages:
next: 14.1.0
eslint-config-next: 14.1.0
react: 18.2.0
react-dom: 18.2.0
typescript: 5.3.3
Next.js Config:
output: N/A