In index.js i used getStaticProps function and export it. I wanted to whenever a user visit my page, my api call will run. But i wanted to make this api call every (for example) 60 seconds, not everytime for every user. But, revalidate its not working. I deployed it on vercel. But my website is making api call just ONCE and not doing again.
How can i fix that issue?
Here is my webstie: emirhash.vercel.app
Revalidation is working correctly but your ApolloClient is caching the graphql request, so that is why getStaticProps
returns the same result everytime.
To fix this, set the fetchPolicy
to .network-only"
for that query.
const { data } = await client.query({
query: yourQuery,
fetchPolicy: "network-only"
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.