Trends: price-history fetch failure with no data raises the connection banner

A history fetch that comes back empty BECAUSE the mirror is unreachable
(pointer probe failed) was only an in-sheet retry card — no global signal.
Now it also raises the red connection banner ('Check your internet
connection / Tap to try again'), so a network problem is visible on every
tab, not just inside the Trends sheet. A successful load clears the
banner (only when the banner is the connection banner — never clobbers
the offline-dump banner).

- TrendsView: onHistoryUnavailable/onHistoryRecovered closures fired from
  load() (loadFailed -> unavailable; hasAnyData -> recovered);
  -forceHistoryFailure QA hook (forces the unreachable state, skips
  auto-refresh like the other force-* hooks)
- FavouritesView: closures threaded through the Trends sheet init
- ContentView: wires them to dataStatus (.live -> .connectionProblem on
  failure; recovered clears only .connectionProblem)
- fuelboard-development skill: hook + wiring documented
This commit is contained in:
FuelBoard Contributor
2026-08-16 12:31:35 +01:00
parent a6dbe8c46e
commit e0e5b36503
3 changed files with 39 additions and 4 deletions
+4 -2
View File
@@ -284,7 +284,7 @@ struct ContentView: View {
updateLiveActivity()
// Refresh only when the cache is stale (twice-a-day policy).
// Skipped under the force-* hooks so the banner stays up.
if !args.contains("-forceOfflineDump") && !args.contains("-forceConnectionProblem") {
if !args.contains("-forceOfflineDump") && !args.contains("-forceConnectionProblem") && !args.contains("-forceHistoryFailure") {
Task { await refresh() }
}
} else {
@@ -526,7 +526,9 @@ struct ContentView: View {
distanceUnit: distanceUnit,
priceDisplayStyle: priceDisplayStyle,
onToggleFavourite: toggleFavourite,
onReorder: reorderFavourites
onReorder: reorderFavourites,
onHistoryUnavailable: { if dataStatus == .live { dataStatus = .connectionProblem } },
onHistoryRecovered: { if dataStatus == .connectionProblem { dataStatus = .live } }
)
}