From 3da931b8568093cb3f819ba2e8d992b5c9c6d544 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 30 Oct 2026 17:49:52 -0700 Subject: [PATCH] Find HTML images before updating rows when a timeline thumbnail fails. --- Mac/MainWindow/Timeline/TimelineViewController.swift | 7 +++---- iOS/MainTimeline/MainTimelineViewController.swift | 11 ++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index ddc2099b0..221f02f31 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -800,13 +800,12 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr guard showsThumbnails, let articleIDs = notification.userInfo?[ArticleThumbnailFinder.articleIDsKey] as? Set else { return } - // Articles that used the failed URL now get their next source, or none. - thumbnailURLsDidChange(for: articleIDs) - - // A failed provided image falls back to images in the HTML. + // A failed provided image falls back to images in the HTML. Those are found first, so a row that has one doesn’t shrink and then grow back. let articlesUsingURL = articles.filter { articleIDs.contains($0.articleID) } Task { await ArticleThumbnailFinder.shared.discoverThumbnailURLs(for: articlesUsingURL) + // Articles that used the failed URL now get their next source, or none. + thumbnailURLsDidChange(for: articleIDs) } } diff --git a/iOS/MainTimeline/MainTimelineViewController.swift b/iOS/MainTimeline/MainTimelineViewController.swift index b08f28fa2..235907f15 100644 --- a/iOS/MainTimeline/MainTimelineViewController.swift +++ b/iOS/MainTimeline/MainTimelineViewController.swift @@ -1264,15 +1264,12 @@ private extension MainTimelineViewController { guard thumbnailMode != nil, let articleIDs = notification.userInfo?[ArticleThumbnailFinder.articleIDsKey] as? Set else { return } - // Articles that used the failed URL now get their next source, or none. - thumbnailURLsDidChange(for: articleIDs) - - // A failed provided image falls back to images in the HTML. - guard let articlesUsingURL = articles?.filter({ articleIDs.contains($0.articleID) }) else { - return - } + // A failed provided image falls back to images in the HTML. Those are found first, so a row that has one doesn’t shrink and then grow back. + let articlesUsingURL = articles?.filter { articleIDs.contains($0.articleID) } ?? [] Task { await ArticleThumbnailFinder.shared.discoverThumbnailURLs(for: articlesUsingURL) + // Articles that used the failed URL now get their next source, or none. + thumbnailURLsDidChange(for: articleIDs) } }