Skip to content

Commit

Permalink
Fix a leak related to autoclosure
Browse files Browse the repository at this point in the history
  • Loading branch information
Amol Prabhu committed Aug 8, 2024
1 parent 104cc94 commit 292cca2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Apollo/ApolloStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ public class ApolloStore {
public class ReadTransaction {
fileprivate let cache: any NormalizedCache

fileprivate lazy var loader: DataLoader<CacheKey, Record> = DataLoader(self.cache.loadRecords)
fileprivate lazy var loader: DataLoader<CacheKey, Record> = DataLoader { [weak self] batchLoad in
guard let self else { return [:] }
return try cache.loadRecords(forKeys: batchLoad)
}

fileprivate lazy var executor = GraphQLExecutor(
executionSource: CacheDataExecutionSource(transaction: self)
)
Expand Down

0 comments on commit 292cca2

Please sign in to comment.