@@ -10,7 +10,7 @@ public typealias BatchLoadFunction<Key: Hashable & Sendable, Value: Sendable> =
1010 @Sendable ( _ keys: [ Key ] ) async throws -> [ DataLoaderValue < Value > ]
1111private typealias LoaderQueue < Key: Hashable & Sendable , Value: Sendable > = [ (
1212 key: Key ,
13- channel: Channel < Value , Error >
13+ channel: Channel < Value , Error , State < Value , Error > >
1414) ]
1515
1616/// DataLoader creates a public API for loading data from a particular
@@ -25,7 +25,7 @@ public actor DataLoader<Key: Hashable & Sendable, Value: Sendable> {
2525 private let batchLoadFunction : BatchLoadFunction < Key , Value >
2626 private let options : DataLoaderOptions < Key , Value >
2727
28- private var cache = [ Key : Channel < Value , Error > ] ( )
28+ private var cache = [ Key : Channel < Value , Error , State < Value , Error > > ] ( )
2929 private var queue = LoaderQueue < Key , Value > ( )
3030
3131 private var dispatchScheduled = false
@@ -46,7 +46,7 @@ public actor DataLoader<Key: Hashable & Sendable, Value: Sendable> {
4646 return try await cached. value
4747 }
4848
49- let channel = Channel < Value , Error > ( )
49+ let channel = Channel < Value , Error , State < Value , Error > > ( )
5050
5151 if options. batchingEnabled {
5252 queue. append ( ( key: key, channel: channel) )
@@ -148,7 +148,7 @@ public actor DataLoader<Key: Hashable & Sendable, Value: Sendable> {
148148 let cacheKey = options. cacheKeyFunction ? ( key) ?? key
149149
150150 if cache [ cacheKey] == nil {
151- let channel = Channel < Value , Error > ( )
151+ let channel = Channel < Value , Error , State < Value , Error > > ( )
152152
153153 Task . detached {
154154 await channel. fulfill ( value)
0 commit comments