Open steebchen opened 1 year ago
I'm seeing the same issue. While investigating why I'm getting timeouts on basic pages, I put logs in to time the performance of queries. Functions that are meant to be cached, written as per the docs, are not being cached at all. https://github.com/vercel/next.js/discussions/63124
Link to the code that reproduces this issue
https://github.com/steebchen/chaininfo
To Reproduce
MORALIS_API_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJub25jZSI6IjhkYTVhNjk4LTZlZDEtNGQzOC1hMTdkLTJiMzU2NDJlZmY5ZSIsIm9yZ0lkIjoiMTA2NTExIiwidXNlcklkIjoiMTA2MTU3IiwidHlwZUlkIjoiZTIwY2I5ZGItNjUyMC00YThhLWI5NTAtZDJhYjllNzJjYjJkIiwidHlwZSI6IlBST0pFQ1QiLCJpYXQiOjE2ODQ5NDQ5NzMsImV4cCI6NDg0MDcwNDk3M30.wNw62dF_sZK6lvjAb7siGhKSeIB21zClq1PdvuX3NVo
(temp access key) in.env.production.local
x
withgetAddressDataCache
https://github.com/steebchen/chaininfo/blob/main/app/address/%5Bslug%5D/page.tsx#L20Current vs. Expected behavior
Nothing gets cached. From the logs if you refresh multiple times
The
getAddressData
is not supposed to be logged multiple times, as I set the revalidate. It works fine withunstable_cache
from next, but it does not withcache
from react.Relevant code:
https://github.com/steebchen/chaininfo/blob/f6df81e62acbb2c3e7072df73154bebfde1f39df/data/address-cache.ts#L4-L9
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router
Additional context
I followed the docs for this: https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#example