From d1e1948409d3eba8c7addc9343329248a44924ab Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 30 Aug 2026 16:56:53 +0200 Subject: [PATCH] Filter the discarded feed timestamps on their own keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The two dictionaries are not guaranteed to agree, and walking only the video keys left a timestamp behind for any feed entry that had already lost its videos. Nothing reads it — validity requires the videos too — but it names a feed this login was never shown. --- Yattee/Services/HomeInstanceCache.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Yattee/Services/HomeInstanceCache.swift b/Yattee/Services/HomeInstanceCache.swift index 70b079b1..9b54b396 100644 --- a/Yattee/Services/HomeInstanceCache.swift +++ b/Yattee/Services/HomeInstanceCache.swift @@ -97,12 +97,15 @@ final class HomeInstanceCache { // popular and trending, which are public and cost a cold start // to fetch again. Anything the new login has already cached // wins over what came off disk. + let isFeedKey = { (key: String) in + key.hasSuffix("_\(InstanceContentType.feed.rawValue)") + } var videos = cacheData.videos var timestamps = cacheData.lastUpdated - for key in videos.keys where key.hasSuffix("_\(InstanceContentType.feed.rawValue)") { - videos.removeValue(forKey: key) - timestamps.removeValue(forKey: key) - } + // Filtered independently: a timestamp can outlive its entry, + // and one left behind is a feed this login was never shown. + videos = videos.filter { !isFeedKey($0.key) } + timestamps = timestamps.filter { !isFeedKey($0.key) } videos.merge(cache) { _, current in current } timestamps.merge(lastUpdated) { _, current in current }