Skip to content

Commit

Permalink
Fixed double-callback for cached images
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nicklockwood authored and facebook-github-bot-7 committed Nov 23, 2015
1 parent 274c5c7 commit f827a51
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Libraries/Image/RCTImageLoader.m
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ - (RCTImageLoaderCancellationBlock)loadImageWithTag:(NSString *)imageTag
NSCachedURLResponse *cachedResponse = [_URLCache cachedResponseForRequest:request];
if (cachedResponse) {
processResponse(cachedResponse.response, cachedResponse.data, nil);
return;
}

// Download image
Expand Down

0 comments on commit f827a51

Please sign in to comment.