File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -166,14 +166,14 @@ export default class DataLoader<K, V> {
166
166
var cacheKeyFn = this . _options && this . _options . cacheKeyFn ;
167
167
var cacheKey = cacheKeyFn ? cacheKeyFn ( key ) : key ;
168
168
169
- // Cache a rejected promise if the value is an Error, in order to match the
170
- // behavior of load(key).
171
- var promise = value instanceof Error ?
169
+ // Only add the key if it does not already exist.
170
+ if ( this . _promiseCache . get ( cacheKey ) === undefined ) {
171
+ // Cache a rejected promise if the value is an Error, in order to match
172
+ // the behavior of load(key).
173
+ var promise = value instanceof Error ?
172
174
Promise . reject ( value ) :
173
175
Promise . resolve ( value ) ;
174
176
175
- // Only add the key if it does not already exist.
176
- if ( this . _promiseCache . get ( cacheKey ) === undefined ) {
177
177
this . _promiseCache . set ( cacheKey , promise ) ;
178
178
}
179
179
You can’t perform that action at this time.
0 commit comments