Skip to content

Commit

Permalink
Feature/ContextIdentifier for the mutate queries (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirK-ah authored and gh-action-runner committed Mar 4, 2024
1 parent aa2f1a4 commit 3a7e0c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apollo-ios/Sources/Apollo/ApolloClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ extension ApolloClient: ApolloClientProtocol {
@discardableResult
public func perform<Mutation: GraphQLMutation>(mutation: Mutation,
publishResultToStore: Bool = true,
contextIdentifier: UUID? = nil,
context: RequestContext? = nil,
queue: DispatchQueue = .main,
resultHandler: GraphQLResultHandler<Mutation.Data>? = nil) -> Cancellable {
return self.networkTransport.send(
operation: mutation,
cachePolicy: publishResultToStore ? .default : .fetchIgnoringCacheCompletely,
contextIdentifier: nil,
contextIdentifier: contextIdentifier,
context: context,
callbackQueue: queue,
completionHandler: { result in
Expand Down
2 changes: 2 additions & 0 deletions apollo-ios/Sources/Apollo/ApolloClientProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: GraphQLMutation>(mutation: Mutation,
publishResultToStore: Bool,
contextIdentifier: UUID?,
context: RequestContext?,
queue: DispatchQueue,
resultHandler: GraphQLResultHandler<Mutation.Data>?) -> Cancellable
Expand Down

0 comments on commit 3a7e0c9

Please sign in to comment.