Per page staleTimes configuration #82846
hubertoschusch
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
I am using dynamic routes with prefetching on the server to improve load time, but I also want to cache the passed data on the client for example for 5 minutes. So not every new revisit to the page causes a server request, which causes the client to wait until the request is done (Like using tanstack query caching).
This is currently possible via the EXPERIMENTAL staleTimes configuration next.config.ts but only configurable globally. Now I might want to have a shorter caching time on one page than on another and that is currently not possible.
Background
I think this is a basic caching functionality and should NOT be experimental and also should be configurable per PAGE. I don't know how this is not a bigger issue for people?
Proposal
Make staleTimes configurable per Page just like the route segment config variables
TLDR
Caching dynamic route page response from nextjs server on client side (Router cache) currently only possible via EXPERIMENTAL and globally configured staleTimes variable.
Beta Was this translation helpful? Give feedback.
All reactions