Skip to content
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

Manage the order of certain interceptors in ApolloClient.Builder #5874

Open
BoD opened this issue May 2, 2024 · 0 comments
Open

Manage the order of certain interceptors in ApolloClient.Builder #5874

BoD opened this issue May 2, 2024 · 0 comments

Comments

@BoD
Copy link
Contributor

BoD commented May 2, 2024

With the current ApolloClient.Builder, the order in which interceptors are added is used to build the chain. This can lead to some friction, as certain options automatically add an interceptor (e.g. normalized cache) and certain interceptors actually need to be in a specific order (e.g. NormalizedCache must be before APQ). To account for this, currently we make certain checks in the code, like this, which is not ideal.

Instead we can add dedicated builder methods for specific types of interceptors, and add them in the desired order when calling .build():

  • setNormalizedCacheInterceptor()
  • setApqInterceptor()
  • setRetryInterceptor()
  • setNetworkInterceptor()

See also #5858.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants