Replies: 5 comments
-
I was also wondering about that - it would be great to support something in that direction 🤔 |
Beta Was this translation helpful? Give feedback.
-
I'm facing this issue too.
|
Beta Was this translation helpful? Give feedback.
-
Hi, is there a plan to fix or get a workaround on this? |
Beta Was this translation helpful? Give feedback.
-
It's now possible to customize |
Beta Was this translation helpful? Give feedback.
-
Thank you for the information! It does seem like this approach would partially achieve what I'm aiming for. I'll give it a try. However, when I think about a route where, for example, I want to cache a gRPC request for 1 minute but avoid caching a DB query altogether, it seems that we would still need more fine-grained control at the Data cache level.As far as I understand, fetch() was updated so that data cache is no longer dependent on the slowest revalidation frequency within the same route, which is great. For what I’m trying to achieve, unstable_cache may be a closer match. I still have some concerns about its stability at this point. Nevertheless, if there’s a separate master issue tracking unstable_cache, perhaps this issue can be closed and the conversation can be continued there. |
Beta Was this translation helpful? Give feedback.
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
Background
For me at least, in a typical use case, the asynchronous requests to make from React Server Components are not REST: they are GraphQL, gRPC, direct CRUD of the database via Prisma, etc.
However, in App Router, you can only utilize the cache control feature of the
fetch()
function when calling simple HTTP-based endpoints (so-called REST-style)I know
cache()
function, but it only supports request deduping, not ISR/SG cache control.It would be a shame if the fine-grained cache control of the
fetch()
function is actually useless in most use cases.Proposal
How about add support ISR/SG cache control feature to
cache()
function?It might be more practical to create some module like
next/cache
which wraps react'scache()
function.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions