Let Subscriptions settle on an answer and heal when the server returns

MAC3: an error the context banner answers now reaches a terminal Feed
Unavailable view instead of the spinner branch; an effective-context move
keeps the cached feed instead of purging it; the view retries on appear,
on activation, on a status lift, and every minute while a network error
is on screen.
This commit is contained in:
Arkadiusz Fal
2026-09-11 19:08:25 +02:00
parent b0b95195b6
commit 94b2dff75b
2 changed files with 117 additions and 6 deletions

View File

@@ -310,6 +310,24 @@ final class SubscriptionFeedCache {
isLoading = false
}
/// Fences whatever is in flight and lets a replacement start, keeping the
/// feed that is already here.
///
/// For a move between the selected account and local data that the user did
/// not make — an unreachable server, an instance switched off. The
/// selection has not changed, so what is cached is still that account's own
/// feed and it is the only thing standing between the banner and an empty
/// screen. Purging it is what left the feed with nothing to fall back to
/// and no way to reach a terminal state: the request it emptied the cache
/// for is the one that cannot answer.
func handleEffectiveContextChange() {
LoggingService.shared.info("Subscription reads moved, keeping the cached feed", category: .general)
accountGeneration += 1
cancelPolling()
feedLoadState = .idle
isLoading = false
}
/// Which login the cache currently holds data for.
private var accountGeneration = 0