[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live) [Help](/c/help/9) # Cached function in layout and page runs twice 46 views · 0 likes · 1 post Kostas Pblworks (@kostas-pblworks) · 2024-08-19 Docs [here](https://nextjs.org/docs/app/building-your-application/data-fetching/fetching#orms-and-database-clients) state that: > You can use [React cache](https://react.dev/reference/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](https://codesandbox.io/p/devbox/sparkling-water-jfcr4f), you can see in the logs that it gets called twice. Tested in both Vercel deployment and locally. ## To Reproduce 1. Open the sandbox above 2. Clear the terminal 3. Check the logs 4. Refresh the embedded browser 5. `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 ```