Disappointed to see the deprecation of CacheAndNet...
# apollo-kotlin
j
Disappointed to see the deprecation of CacheAndNetwork, but I kind of understand: https://github.com/apollographql/apollo-kotlin-normalized-cache/pull/205 I do understand chaining 2 states has limitations (what if you want CacheAndLocalDatabaseAndNetwork), etc too. this shorthand is helpful for our react native familiar engineers coming from apollo react client. Would be nice if it was possible to contribute our own fetch policies with their own set of execution options (or similar?)
fetchPolicy(FetchPolicy.CacheOnly).toFlow().onCompletion { emitAll(fetchPolicy(FetchPolicy.NetworkOnly).toFlow()) }
thats pretty verbose...
b
Thanks a lot for the feedback! One reason for the deprecation is that this policy doesn't play nice with
.execute()
unlike the other ones. > thats pretty verbose... True, but you can make it an extension to not repeat it everywhere. > Would be nice if it was possible to contribute our own fetch policies with their own set of execution options (or similar?) You can actually! By setting your own
fetchPolicyInterceptor
. An example here.
1
j
ah thanks for the tips!