apollo-kotlin icon indicating copy to clipboard operation
apollo-kotlin copied to clipboard

ApolloStore with "remove(key, cascade)" does not delete any records

Open ahetawal-p opened this issue 4 years ago • 1 comments

I am using apollo store to cascade delete my records using something like this:

val results = apolloClient.apolloStore.remove(CacheKey.from("Parent_KEY"), cascade = true)
results.execute()

And my Parent_KEY points to this record in DB:

{
"__typename":"MyRECORD",
"summary":"ApolloCacheReference{Summary_key_name}",
"children":["ApolloCacheReference{Summary_key_name_child1}","ApolloCacheReference{Summary_key_name_child2}"],
"parents":["ApolloCacheReference{Summary_key_name_parent1}","ApolloCacheReference{Summary_key_name_parent2}"]
}

Using the apolloStore.remove(CacheKey.from("Parent_KEY"), true) DOES NOT remove any records from my cache, however using apolloStore.remove(CacheKey.from("Parent_KEY")) only removes the Parent_KEY.

It seems cascade flag is not working as expected ?

Version 2.3.0

ahetawal-p avatar Oct 14 '20 19:10 ahetawal-p

I can share similar behavior also happens in 3.0.0 and I can share a repro

Removing a key with cascade=true seems to remove cache entries only from the first cache.

mateuszkwiecinski avatar Dec 16 '21 17:12 mateuszkwiecinski