Hi all,
Let’s say the query is as follow:
query FetchWeather($currentTime: String) {
weather(currentTime: $currentTime) {
temperature
}
}
I was trying to fetch weather multiple times (ofc “currentTime” will be different every time). Every time I did a fetch, I was hoping the cache to completely replace the old weather data with new data, meaning I just wanted the last one I fetched storing in the cache.
But when Apollo tried to cache the the data with normalization, it would internally take the currentTime as part of the cache key, e.g. “weather:{currentTime}”. Since every time the key was different, it resulted in the consequence that all weathers’ data were staying in the cache.
I tried the “custom cache keys” approach from Apollo doc, but it only deduplicated the stored data by establishing a reference from “weather:{currentTime}” to “someUnifiedWeather”. In such way, currentTime was still used so that cache would always miss when reading.
One looks-like solution I found was setting keyArgs as false (Key arguments in Apollo Client - Apollo GraphQL Docs), but it’s a feature in React client .
Is there any solution to this problem for iOS?