From 9b35e47f68aa6f9ffcb310d90da3cad2df39b5fa Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 3 Nov 2026 09:50:36 -0800 Subject: [PATCH] =?UTF-8?q?Request=20a=20feed=20icon=20when=20it=20isn?= =?UTF-8?q?=E2=80=99t=20in=20memory.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Images/Sources/Images/FeedIconDownloader.swift | 5 ----- Shared/IconImageCache.swift | 3 ++- iOS/MainFeed/MainFeedCollectionViewController.swift | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Modules/Images/Sources/Images/FeedIconDownloader.swift b/Modules/Images/Sources/Images/FeedIconDownloader.swift index 8f603803f..8eabb5241 100644 --- a/Modules/Images/Sources/Images/FeedIconDownloader.swift +++ b/Modules/Images/Sources/Images/FeedIconDownloader.swift @@ -186,11 +186,6 @@ extension Notification.Name { _ = icon(for: feed) } } - - /// Returns the in-memory icon for `feed` without triggering a download. - public func cachedIcon(for feed: Feed) -> IconImage? { - cache[feed]?.iconImage - } } private extension FeedIconDownloader { diff --git a/Shared/IconImageCache.swift b/Shared/IconImageCache.swift index 448066864..e5667b807 100644 --- a/Shared/IconImageCache.swift +++ b/Shared/IconImageCache.swift @@ -138,7 +138,8 @@ private extension IconImageCache { // dictionaries so a newly arrived icon replaces a stale one. The dictionaries // keep the last known icons across the downloaders’ low-memory and background flushes. // - if let iconImage = FeedIconDownloader.shared.cachedIcon(for: feed) { + // A miss requests the feed icon, so it comes back after a flush without waiting for a prefetch. + if let iconImage = FeedIconDownloader.shared.icon(for: feed) { feedIconImageCache[feedID] = iconImage return iconImage } diff --git a/iOS/MainFeed/MainFeedCollectionViewController.swift b/iOS/MainFeed/MainFeedCollectionViewController.swift index 48e69d3f5..c7f99cd7c 100644 --- a/iOS/MainFeed/MainFeedCollectionViewController.swift +++ b/iOS/MainFeed/MainFeedCollectionViewController.swift @@ -885,7 +885,6 @@ final class MainFeedCollectionViewController: UICollectionViewController, Undoab // MARK: - Notifications @objc func preferredContentSizeCategoryDidChange() { - IconImageCache.shared.emptyCache() reloadAllVisibleCells() }