wasyl
12/15/2020, 6:43 PMCacheKeyResolver
and fromFieldRecordSet
and fromFieldArguments
methods?
fromFieldRecordSet
seems like it asks for cache key for every object (non-scalar) in the response? But what does fromFieldArguments
do?mbonnin
12/15/2020, 6:52 PMmbonnin
12/15/2020, 6:53 PMmbonnin
12/15/2020, 6:54 PMquery AuthorById($id: String!) {
author(id: $id) {
id
name
}
}
}
mbonnin
12/15/2020, 6:54 PMfromFieldArguments
tells the cache to use the id from the argumentsmbonnin
12/15/2020, 6:54 PMfromFieldRecordSet
tells the cache to use the id from the responsewasyl
12/15/2020, 6:58 PMfromFieldArguments
has preference over fromFieldRecordSet
when computing cache for the object directly under a field?
In your example, if fromFieldArguments
returns the ID, does fromFieldRecordSet
still need to run?mbonnin
12/15/2020, 7:03 PMfromFieldArguments
will run before the network to check if there's something in the cache. fromFieldRecordSet
will run after to store the value in the cachewasyl
12/15/2020, 7:12 PM