Fixed double-callback for cached images

Summary: public

A missing return statement in RCTImageLoader meant that cached images would be loaded twice - once from cache and again from the source.

This was mostly innocuous, causing only a slight perf regression due to the image cache being effectively disabled, however in some cases (such as RCTImageEditingManager.cropImage) it caused the success callback to fire twice, resulting in a crash.

Reviewed By: fkgozali

Differential Revision: D2684956

fb-gh-sync-id: 7580a6fbfe00a30807951803e04bfcdbee3bb80a
This commit is contained in:
Nick Lockwood 2015-11-23 04:18:20 -08:00 committed by facebook-github-bot-7
parent 274c5c78c4
commit f827a513a1
1 changed files with 1 additions and 0 deletions

View File

@ -290,6 +290,7 @@ RCT_EXPORT_MODULE()
NSCachedURLResponse *cachedResponse = [_URLCache cachedResponseForRequest:request]; NSCachedURLResponse *cachedResponse = [_URLCache cachedResponseForRequest:request];
if (cachedResponse) { if (cachedResponse) {
processResponse(cachedResponse.response, cachedResponse.data, nil); processResponse(cachedResponse.response, cachedResponse.data, nil);
return;
} }
// Download image // Download image