David Albers
09/26/2022, 2:42 PMquery Accounts($filter: Filter) {
accounts(filter: $filter) {
id
type
name
}
}
where the parameter is a filter and it’s optional. If no filter is given, you get an unfiltered list.
The main screen in my app requests this data with filter: null
so it can get all the accounts. A detail screen requests the data with filter: {type: OPEN}
.
I’m seeing a cache miss when I go to the detail screen. Is there a way for the detail screen to get cached data from the main screen even though the params are different?David Albers
09/26/2022, 2:43 PMCacheKey("Account:${obj["type"]}:${obj["id"]}")
. I assume there’s something there I need to change but I’m not sure what.bod
09/26/2022, 2:52 PMDavid Albers
09/26/2022, 3:27 PMbod
09/26/2022, 3:30 PMmbonnin
09/26/2022, 3:33 PMCacheResolver
APImbonnin
09/26/2022, 3:34 PMfilter: null
is always the same as filter: {type: OPEN}
, you could handle that programmaticallymbonnin
09/26/2022, 3:36 PMval name = field.nameWithArguments(variables)
if (!parent.containsKey(name)) {
throw CacheMissException(parentId, name)
}
return parent[name]
}
So if you can make it so that name
above becomes accounts(filter: null)
whenever {type: OPEN}
is passed, data will be looked up from the parent record