1

I would like to be able to clear the cache of only one specified type

e.g. if I have Authors and Books I would like to only clear cache for Authors

I'm using @apollo/client": "^3.2.5" (latest)

Just additional note, shouldn't matter much but I'm using it with Angular.

apollo.client.clearStore(); // this clears all store

Tried to use the apollo.client.cache.writeQuery, however no luck yet

Remove by the __typename would be ideal or something related

Stephen Lautier
  • 3,065
  • 3
  • 17
  • 20

1 Answers1

1

Using the v3 it seems by using the evict api is doing what I needed

this.apollo.client.cache.evict({
    fieldName: "authors",
});
Stephen Lautier
  • 3,065
  • 3
  • 17
  • 20