Skip to content

Commit

Permalink
Fix possible retain cycle in network fetch interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
designatednerd committed Oct 30, 2020
1 parent ddb4e7d commit 9df9f04
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Apollo/NetworkFetchInterceptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ public class NetworkFetchInterceptor: ApolloInterceptor, Cancellable {
return
}

self.currentTask = self.client.sendRequest(urlRequest) { result in
self.currentTask = self.client.sendRequest(urlRequest) { [weak self] result in
guard let self = self else {
return
}

defer {
self.currentTask = nil
}
Expand Down

0 comments on commit 9df9f04

Please sign in to comment.