With nextjs, the cache limit for a fetch is 2MB. However, some of my fetches are larger than 2 MB and the data is therefore not cached, which is very annoying because I make calls to my api again when I navigate to my component via Link (dynamique routes). The fetch is called as a preload, but the call to the api is also recalled a second time when the component is called, for all the routes concerned where I need to fetch this data. (so it makes 2 calls to my api instead of 0 for a every route)
So I have hundreds of calls to the api because of the cache limit... Do you have a solution to my problem? Maybe use something other fetching methods ?
thanks everyone
tried to reduce the size of my json fetched but its not a good solution in my case
Since Next 14.2.5+ the cache limit is not checked when setting a custom cacheHandler.
You can simply reimport the default cache handler!
Either in situ:
import FileSystemCache from 'next/dist/server/lib/incremental-cache/file-system-cache.js';
export default FileSystemCache;
Or in next.config.js
cacheHandler: require.resolve(
    'next/dist/server/lib/incremental-cache/file-system-cache.js',
),
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With