Question about unstable_cache and reusing the returned function
Unanswered
meenie posted this in #help-forum
meenieOP
I'm utilizing the latest version (14.0.3) of NextJS and the App directory for my pages.
I want to get clarification on something. I have a Supabase query (
The other scenario I'm seeing is that when I do
I remember reading in the NextJS docs that there should be request deduplication because you are wrapping the
It would be really great to get some decent answers to these questions so the docs for
I want to get clarification on something. I have a Supabase query (
queryA) I've wrapped in unstable_cache and another Supabase query (queryB) that is also wrapped in unstable_cache that needs data from queryA (Trying to keep things DRY). I've got two separate revalidate tags on each. When I load the page that utilizes both methods to load data, queryA is ran twice when I would have thought that manually calling queryA within queryB would utilize the cache that was created for queryA on the first request.The other scenario I'm seeing is that when I do
revalidateTag() on queryBs tag, it also re-runs queryA when I have not ran revalidateTag() on the queryA tag.I remember reading in the NextJS docs that there should be request deduplication because you are wrapping the
fetch() function. I believe Supabase is utilizing fetch() under the hood, so it should still apply.It would be really great to get some decent answers to these questions so the docs for
unstable_cache() can utilize them. I realize the cache utility is not fully released yet and is subject to change, but it would still be great to have this information in the docs.