From e829b7a83ea06c0e245c191e9c929cfacf8f6c43 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 20 Apr 2026 14:44:23 +0300 Subject: [PATCH] avoid expensive sync disk read --- .../ios/ImagePreviewController.swift | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/expo-bluesky-context-menu/ios/ImagePreviewController.swift b/modules/expo-bluesky-context-menu/ios/ImagePreviewController.swift index 7daa94e5dd..29aab212d6 100644 --- a/modules/expo-bluesky-context-menu/ios/ImagePreviewController.swift +++ b/modules/expo-bluesky-context-menu/ios/ImagePreviewController.swift @@ -77,15 +77,11 @@ final class ImagePreviewController: UIViewController { } } - /// Synchronous cache lookup across memory + disk. Memory hits are instant; - /// disk hits incur a small read but remain on-thread (matches what SDWebImage - /// does when the cache policy permits). + /// Memory-only cache lookup. Disk reads are left to the async SDWebImage + /// load to avoid blocking the main thread during the peek animation. private func cachedImage(for url: URL) -> UIImage? { let key = SDWebImageManager.shared.cacheKey(for: url) ?? url.absoluteString - if let memory = SDImageCache.shared.imageFromMemoryCache(forKey: key) { - return memory - } - return SDImageCache.shared.imageFromDiskCache(forKey: key) + return SDImageCache.shared.imageFromMemoryCache(forKey: key) } /// Caps the preview to a comfortable size within the current key window.