"use cache" route marked as dynamic by dev tools
Answered
American black bear posted this in #help-forum
American black bearOP
I have a home page which is marked with "use cache", however the dev tools in the bottom left screen say that my home route
It is also worth noting that I am using route specific layout feature for my homepage e.g.
/
is dynamic. Is this a bug or am I not caching the page properly?It is also worth noting that I am using route specific layout feature for my homepage e.g.
/src/app/(main)/page.tsx
.Answered by American black bear
I can confirm that the page is indeed cached with
"use cache"
marked on top of the file, but the dev tools say that the route is dynamic. Probably a bug.5 Replies
I don't think the
use cache
is to be marked at the top but inside the function itself@American black bear I have a home page which is marked with "use cache", however the dev tools in the bottom left screen say that my home route `/` is dynamic. Is this a bug or am I not caching the page properly?
It is also worth noting that I am using route specific layout feature for my homepage e.g. `/src/app/(main)/page.tsx`.
next.js: 15.2.0
if you need migrate use:
https://nextjs.org/docs/app/api-reference/directives/use-cache
https://nextjs.org/blogs/composable-caching
if you need migrate use:
npx @next/codemod@canary upgrade latest
bunx @next/codemod@canary upgrade latest
# ...your prefer package manager comand here!
https://nextjs.org/docs/app/api-reference/directives/use-cache
https://nextjs.org/blogs/composable-caching
that's all you need to know to use it well.
in case the migration has been performed previously and the
page.tsx
component does not working as expected, please mention it.American black bearOP
I can confirm that the page is indeed cached with
"use cache"
marked on top of the file, but the dev tools say that the route is dynamic. Probably a bug.Answer