https://kotlinlang.org logo
Title
j

james

09/13/2021, 1:21 AM
apollo 2.x.x had
clearNormalizedCache
function available on ApolloClient, how do you perform this with apollo3?
m

mbonnin

09/13/2021, 6:50 AM
In 3.x, ApolloClient doesn't know anything about the cache. You'll have to hold a reference to the store and call it from there:
store = ApolloStore(MemoryCacheFactory())
    apolloClient = ApolloClient(mockServer.url()).withStore(store)
    // Do something with apolloClient ...
    // Clear the store
    store.clearAll()
We might add an extension function (like we did for
watch
for an example) although I personally find it nice to unbundle client and cache. I find it separates responsibilities a bit more.
It's deprecated for now as the same functionality is available through store.clearAll().
👍 1