From c517981c4ee5ca0e8866567d590d51f86a683cd4 Mon Sep 17 00:00:00 2001 From: gh-action-runner Date: Mon, 4 Mar 2024 18:28:00 +0000 Subject: [PATCH] Squashed 'apollo-ios/' changes from b434fb90..1f8afaea 1f8afaea Feature/ContextIdentifier for the mutate queries (apollographql/apollo-ios-dev#281) git-subtree-dir: apollo-ios git-subtree-split: 1f8afaea2b8eaad0169b8b16b4bb42d12dd75542 --- Sources/Apollo/ApolloClient.swift | 3 ++- Sources/Apollo/ApolloClientProtocol.swift | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/Apollo/ApolloClient.swift b/Sources/Apollo/ApolloClient.swift index e09bc65c9..f2f0df723 100644 --- a/Sources/Apollo/ApolloClient.swift +++ b/Sources/Apollo/ApolloClient.swift @@ -109,13 +109,14 @@ extension ApolloClient: ApolloClientProtocol { @discardableResult public func perform(mutation: Mutation, publishResultToStore: Bool = true, + contextIdentifier: UUID? = nil, context: RequestContext? = nil, queue: DispatchQueue = .main, resultHandler: GraphQLResultHandler? = nil) -> Cancellable { return self.networkTransport.send( operation: mutation, cachePolicy: publishResultToStore ? .default : .fetchIgnoringCacheCompletely, - contextIdentifier: nil, + contextIdentifier: contextIdentifier, context: context, callbackQueue: queue, completionHandler: { result in diff --git a/Sources/Apollo/ApolloClientProtocol.swift b/Sources/Apollo/ApolloClientProtocol.swift index 125cd950a..5c6180838 100644 --- a/Sources/Apollo/ApolloClientProtocol.swift +++ b/Sources/Apollo/ApolloClientProtocol.swift @@ -54,12 +54,14 @@ public protocol ApolloClientProtocol: AnyObject { /// - Parameters: /// - mutation: The mutation to perform. /// - publishResultToStore: If `true`, this will publish the result returned from the operation to the cache store. Default is `true`. + /// - contextIdentifier: [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Should default to `nil`. /// - context: [optional] A context that is being passed through the request chain. Should default to `nil`. /// - queue: A dispatch queue on which the result handler will be called. Should default to the main queue. /// - resultHandler: An optional closure that is called when mutation results are available or when an error occurs. /// - Returns: An object that can be used to cancel an in progress mutation. func perform(mutation: Mutation, publishResultToStore: Bool, + contextIdentifier: UUID?, context: RequestContext?, queue: DispatchQueue, resultHandler: GraphQLResultHandler?) -> Cancellable