Skip to content

Commit

Permalink
Add cache control check to multisource (facebook#47357)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#47357

`MultiSourceHelper` should not yield an `ImageSource` that has its cache control policy set to `RELOAD`. This change skips such sources when computing the bestCached item (but not best item)

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D65337414

fbshipit-source-id: bdd0d55f4a65128b141a1c7a132dba085232fa11
  • Loading branch information
Abbondanzo authored and facebook-github-bot committed Nov 1, 2024
1 parent 6ab7b70 commit 7211119
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package com.facebook.react.views.imagehelper

import com.facebook.imagepipeline.core.ImagePipelineFactory
import com.facebook.react.modules.fresco.ImageCacheControl

/** Helper class for dealing with multisource images. */
public object MultiSourceHelper {
Expand Down Expand Up @@ -62,7 +63,10 @@ public object MultiSourceHelper {
best = source
}
if (precision < bestCachePrecision &&
source.cacheControl != ImageCacheControl.RELOAD &&
(imagePipeline.isInBitmapMemoryCache(source.uri) ||
// TODO: T206445115 isInDiskCacheSync is a blocking operation, we should move this to
// a separate thread
imagePipeline.isInDiskCacheSync(source.uri))) {
bestCachePrecision = precision
bestCached = source
Expand Down

0 comments on commit 7211119

Please sign in to comment.