From e166dbdd9c2c53bbed23d24239ed6a10a9c7b819 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 3 Nov 2026 14:20:48 -0800 Subject: [PATCH] Reload iOS timeline cells for icon change only when a visible cell might show that icon. --- .../MainTimelineViewController.swift | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/iOS/MainTimeline/MainTimelineViewController.swift b/iOS/MainTimeline/MainTimelineViewController.swift index b4c8487d7..7ff1a0be3 100644 --- a/iOS/MainTimeline/MainTimelineViewController.swift +++ b/iOS/MainTimeline/MainTimelineViewController.swift @@ -398,6 +398,14 @@ final class MainTimelineViewController: UIViewController, UndoableCommandRunner updateQueue.add(self, #selector(reloadVisibleCells)) } + /// Icons arrive in bursts, so the reload is still coalesced. + private func queueReloadIfVisibleArticleMightShowIcon(in notification: Notification) { + guard isViewLoaded, showIcons, visibleArticles().contains(where: { $0.mightShowIcon(in: notification) }) else { + return + } + queueReloadAvailableCells() + } + @objc private func reloadVisibleCells() { Self.logger.debug("MainTimelineViewController: reloadVisibleCells") guard isViewLoaded, let collectionView, let dataSource else { @@ -1133,20 +1141,12 @@ private extension MainTimelineViewController { @objc func handleFeedIconImageDidChange(_ notification: Notification) { Self.logger.debug("MainTimelineViewController: handleFeedIconImageDidChange") - - guard isViewLoaded else { - return - } - queueReloadAvailableCells() + queueReloadIfVisibleArticleMightShowIcon(in: notification) } @objc func handleAuthorAvatarImageDidChange(_ notification: Notification) { Self.logger.debug("MainTimelineViewController: handleAuthorAvatarImageDidChange") - - guard isViewLoaded else { - return - } - queueReloadAvailableCells() + queueReloadIfVisibleArticleMightShowIcon(in: notification) } @objc func timelineIconSizeDidChange(_ note: Notification) {