Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

641
Views
Next.JS getstaticprops revalidate not working

enter image description here

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I solved it. It's not about next.js, its about apollo's InMemoryCache class. I updated my apollo-client.js with following:

import { ApolloClient, InMemoryCache } from "@apollo/client";
const defaultOptions = {
  watchQuery: {
    // fetchPolicy: "cache-and-network",
    fetchPolicy: "no-cache",
    errorPolicy: "ignore",
  },
  query: {
    // fetchPolicy: "network-only",
    fetchPolicy: "no-cache",
    errorPolicy: "all",
  },
};

const client = new ApolloClient({
  uri: "https://api-eu-central-1.graphcms.com/v2/cl21y31cg4c5u01z4fd5o11z6/master",
  cache: new InMemoryCache(),
  defaultOptions,
});

export default client;

And now everythings working as i expected. Thanks everyone.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!