I have a feed component in my application that fetches data from an API endpoint. The component works fine when I test it on my local build, but when I deploy it on Vercel, it doesn't fetch the latest data. I suspect this issue is related to caching. To address the problem, I added the cache: 'no-store' option to the fetch request, but it doesn't seem to solve the problem. I would appreciate any help or suggestions to resolve this issue.
"use client";
const fetchPosts = async () => {
const response = await fetch("/api/prompt", {
cache: 'no-store',
});
const data = await response.json();
setAllPosts(data);
};
useEffect(() => {
fetchPosts();
}, []);
GitHub Link: https://github.com/justinwkUKM/promptify/blob/main/components/Feed.jsx
Note: Please provide any suggestions or solutions for the caching issue when deploying on Vercel. Thank you!