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

Add an API to receive partial responses if the caller wants them #2325

Conversation

StylianosGakis
Copy link
Member

This exposes the new
fun <D : Operation.Data> ApolloCall<D>.safeFlowAllowingPartialResponses(): Flow<Ior<ApolloOperationError, D>>
function singature, for future potential callers who are interested in partial data too.

On the call site, this would practically look something like this

val homeQueryData: HomeQuery.Data = when (homeQueryDataResult) {
  is Both<ApolloOperationError, HomeQuery.Data> -> {
    logcat(WARN) {
      "HomeQuery() responded with a partial result. ApolloOperationError:${homeQueryDataResult.leftValue}"
    }
    homeQueryDataResult.rightValue
  }

  is Left<ApolloOperationError> -> raise(homeQueryDataResult.value)
  is Right<HomeQuery.Data> -> homeQueryDataResult.value
}

so we can move forward with partial data if it's there, and raise/log appropriately

@StylianosGakis StylianosGakis requested a review from a team as a code owner November 25, 2024 16:51
@StylianosGakis StylianosGakis force-pushed the feature/enable-the-possibility-to-ask-for-partial-responses branch from 3757c75 to d55e537 Compare November 25, 2024 17:01
Base automatically changed from ds/claim-flow to develop November 25, 2024 17:11
@StylianosGakis StylianosGakis merged commit 7d93c16 into develop Nov 26, 2024
4 checks passed
@StylianosGakis StylianosGakis deleted the feature/enable-the-possibility-to-ask-for-partial-responses branch November 26, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants