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

141
Views
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
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!