From 18ba14350a691a8e7dfad8426ec16b7ec3904417 Mon Sep 17 00:00:00 2001 From: Hailey Date: Sun, 21 Apr 2024 17:07:21 -0700 Subject: [PATCH] only start placeholder op if doesn't exist in disk cache --- modules/expo-bluesky-gif-view/ios/GifView.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/expo-bluesky-gif-view/ios/GifView.swift b/modules/expo-bluesky-gif-view/ios/GifView.swift index 6c337b3f3a..cfc222f92c 100644 --- a/modules/expo-bluesky-gif-view/ios/GifView.swift +++ b/modules/expo-bluesky-gif-view/ios/GifView.swift @@ -72,7 +72,13 @@ public class GifView: ExpoView, AVPlayerViewControllerDelegate { self.webpOperation?.cancel() self.placeholderOperation?.cancel() - if let url = URL(string: placeholderSource) { + // We only need to start an operation for the placeholder if it doesn't exist + // in the cache already. Cache key is by default the absolute URL of the image. + // See: + // https://github.com/SDWebImage/SDWebImage/blob/master/Docs/HowToUse.md#using-asynchronous-image-caching-independently + if !SDImageCache.shared.diskImageDataExists(withKey: webpSource), + let url = URL(string: placeholderSource) + { self.placeholderOperation = imageManager.loadImage( with: url, options: [.retryFailed],