apollo-android v3.2.1 Release Notes

  • 2022-04-05

    ๐Ÿš€ This release introduces a few improvements and bug fixes.

    โœจ๏ธ [new] ApolloCall<D>.emitCacheMisses(Boolean) (#3980)

    When observing the cache with watch, the behavior was to not emit cache misses at all, which may not desirable in certain cases. With this new option, you can now choose to emit them: in that case responses will be emitted with a null data.

    This can be used like so:

    apolloClient.query(query)
        .fetchPolicy(FetchPolicy.CacheOnly)
        .emitCacheMisses(true)
        .watch()
        .collect { response ->
          // response.data will be null in case of cache misses
        }
    

    This is also closer to the behavior that was in place in v2. Many thanks to @mateuszkwiecinski for the insights and raising the issue!

    ๐Ÿ”ง โš™๏ธ [breaking] Allow configuration of frame types used in SubscriptionWsProtocol and default to Text (#3992)

    0๏ธโƒฃ When using subscriptions over WebSockets with SubscriptionWsProtocol (the default), the frames were sent in the binary format. It was reported that this was not compatible with certain servers (DGS , graphql-java-kickstart) that are expecting text 0๏ธโƒฃ frames. This is now fixed and the default is to send text frames.

    โš ๏ธ This may be a breaking change if your server expects binary frames only!

    ๐Ÿ”ง If that is the case, you can use the new frameType option to configure the frame type to be sent:

    client = ApolloClient.Builder()
        .webSocketServerUrl("wss://...")
        .wsProtocol(GraphQLWsProtocol.Factory(frameType = WsFrameType.Binary))
        .build()
    

    Many thanks to @Krillsson and @aviewfromspace1 for the insights and raising the issue!

    ๐Ÿ‘ทโ€ All changes

    • ๐Ÿ‘ Allow configuration of frame types used in SubscriptionWsProtocol and default to Text (#3992)
    • โž• add ApolloRequest.newBuilder(operation: Operation<E>) (#3988)
    • โž• Add exception handlers to ApolloCacheInterceptor and SqlNormalizedCache (#3989)
    • ๐Ÿ—„ ๐Ÿ“  Fix some @DeprecatedSince annotations (#3983)
    • ๐Ÿ‘“ add ApolloCall.emitCacheMisses(Boolean) (#3980)
    • โš™๏ธ Fix fragments on the root query type in operationBased codegen (#3973)

    โค๏ธ External contributors

    Many thanks to @AdamMTGreenberg and @Krillsson for the contributions! ๐Ÿ™