Erase the Top Shelf feed when its login is discarded

The snapshot is written to the shared app group and read by tvOS with
the app not running, so clearing the cache in memory and on disk left
the previous login's feed sitting on the system home screen. Nothing
rewrote it: only a successful refresh and app launch ever did, so it
survived until whichever came first — and if nobody refreshed under the
new login, indefinitely.

Written from the cleared cache, which is what erases it.
This commit is contained in:
Arkadiusz Fal
2026-08-29 23:51:38 +02:00
parent 395b8eb083
commit 5295dd5e86

View File

@@ -170,6 +170,12 @@ final class SubscriptionFeedCache {
lastUpdated = nil
hasMorePages = false
currentPage = 1
// The Top Shelf snapshot lives in the shared app group and is read by
// tvOS without the app running, so emptying the cache is not enough:
// the previous login's feed would stay on the system home screen until
// some later refresh happened to rewrite it. Written from the cleared
// cache, so this erases it.
TopShelfSnapshotWriter.writeFeed()
diskClearTask = Task {
await FeedCache.shared.clear()
}