Route segment revalidate option doesn't work with axios/react cache. Only unstable_cache works.
Unanswered
Sander posted this in #help-forum
![Avatar](https://cdn.discordapp.com/avatars/244576768701235201/7adb257b4dbdf9ac5c3f9601e48c6c88.webp?size=256)
SanderOP
Is this by design?
get this function:
This works, the fetch requests are cached as the backend receives no extra requests.
However, the current recommended way is using
So this:
Doesn't work, it refetches everytime despite the route segment having
Am I missing something?
get this function:
const getTrackingData = unstable_cache(
async (params: TrackingFormType) => {
return await API.get<TrackingApiData>('/history', {
params,
});
},
undefined,
{
revalidate: 60,
},
);
This works, the fetch requests are cached as the backend receives no extra requests.
However, the current recommended way is using
import {cache} from 'react';
So this:
const getTrackingData = cache(async (params: TrackingFormType) => {
return await API.get<TrackingApiData>('/history', {
params,
});
});
Doesn't work, it refetches everytime despite the route segment having
export const revalidate=900;
.Am I missing something?