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

190
Vistas
How to keep just the last cached query in Apollo client?

I have a paginated graphQL-Query in my react app, which can paginate thousands of rows. The pagination is processed at server. Now I want to use fetchPolicy cache-first, to be able to load a paginationQuery from cache, if i.e. user returns from back to a visited route which uses the paginated data.

This works, but to not overload the memory, I don't want to keep every ROOT_QUERY in cache (over time, the more often the user displays his data differently (different page, different sorting, different filter, etc. ...), the cache would grow immensely). How can I achieve to keep just the last cached query.

i.e.

  const { loading, error, data } = useQuery(GQL_QUERY, {
    variables,
    fetchPolicy: 'cache-first',
    onCompleted: () => {
      //clear old cached versions of my GQL_QUERY no matter what parameters
    }
  });

Thanks

about 4 years ago · Juan Pablo Isaza
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