Next caching api requests aren't being revalidated
Unanswered
Gray Flycatcher posted this in #help-forum
Original message was deleted.
11 Replies
Gray Flycatcher
can anyone help?
Burmese
Can you post a component that is making one of these API calls? Have you tried revalidatePath as recommended?
@Burmese Can you post a component that is making one of these API calls? Have you tried revalidatePath as recommended?
Gray Flycatcher
revaludate path did nothing, wdym by post a component?
Burmese
What does the component look like that is making this API call?
@Burmese What does the component look like that is making this API call?
Gray Flycatcher
it is just a server component that uses axios.get(/getProducts)
@Burmese What does the component look like that is making this API call?
Gray Flycatcher
const response = await axios.get('/api/admin/getProducts');Gray Flycatcher
?
Does the general tag work? Im having the same problem trying to revalidate tags that are dynamic
also you have to have a something that should re-render the object like a useEffect or something so the component changes
Gray Flycatcher
nah it still isnt working
Someone told me that when a request its coming from another side using revalidateTag would not trigger the refresh. This is because when u use revalidate... its making so the fetch its tigger but the next time that you would visit the page it would render with that. So when a post or a get it's called via api but not for your side it would not render your component. You can try this from the other way around, try to revalidate after making a post for example of the product you would see that's working becouse you are the one triggering the revalidate but not something external.