Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

639
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda