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

146
Vistas
Apollo cache modify doesn't delete the cached item field when DELETE sentinel object is returned

I'm trying to delete a field in the cached item by using the cache.modify method like it's described in the official documentation.
Based on the API docs I should return the DELETE sentinel object from the resolver function that reflects the type field I want to delete.

I'm doing it but the required field still exists in the cached item after the execution.
How it's possible? Have I just missed something?

Here is the code example:

I have this item in the cache

{
  __typename:"Module"
  id:"l_14"
  length:223
  title: "Chris Hadfield"
}

and I want to delete the title field so I tried to use the cache.modify as described in the docs. Here is how it looks:

  client.cache.modify({
    id: 'Module:l_14',
    fields: {
      title(data, { DELETE }) {
        return DELETE;
      },
    },
  });

But after the execution, the appropriate Module item in the cache didn't change. The title field hadn't been deleted. It looks exactly like it was before the execution:

{
  __typename:"Module"
  id:"l_14"
  length:223
  title: "Chris Hadfield"
}

So why the title field hadn't been deleted even when I replicated all the steps from the documentation example?

P.S. I'm not sure if it's relevant, probably not, but just in case: this Item doesn't have a direct mutation etc. in the BE schema. It's just a nested object of the parent one. The schema looks like this:

  type Track {
    id: ID!
    title: String!
    author: Author!
    thumbnail: String
    length: Int
    modulesCount: Int
    description: String
    numberOfViews: Int
    modules: [Module!]!
  }

  type Module {
    id: ID!
    title: String!
    length: Int  
   }

Thanks for any help!

about 4 years ago · Santiago Trujillo
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