-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove existing interceptors from ApolloClient.Builder before adding new ones #5858
Conversation
…autoPersistedQueries()
✅ Deploy Preview for apollo-android-docs canceled.
|
...lo-http-cache/src/main/kotlin/com/apollographql/apollo3/cache/http/CachingHttpInterceptor.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This goes one step in the good direction but I think this API is still problematic. The fact that for an example, ApolloClient.Builder.autoPersistedQueries()
is adding an interceptor under the hood is problematic. Code like this is a code smell.
I'm thinking the order should always be:
? HTTP cache itself is a bit awkward because it spans 2 different domains (GraphQL + HTTP). From a quick cursory glance, it looks like it can be anywhere and is probably not going to disturb other |
That sounds right to me 👍 |
Logged #5874 about this. |
…new ones (apollographql#5858) * Remove existing ApolloInterceptors when calling ApolloClient.Builder.httpCache() * Remove existing ApolloInterceptors when calling ApolloClient.Builder.autoPersistedQueries() * Remove existing HttpInterceptors when calling ApolloClient.Builder.httpCache() * Remove existing HttpInterceptors when calling ApolloClient.Builder.httpBatching() * Add a test for httpCache * Don't crash if no `X-APOLLO-SERVED-DATE` header is present * Revert CachingHttpInterceptor change
A follow-up to #5857, for
.httpCache()
,.autoPersistedQueries()
and.httpBatching()
.