From 3cff677729fefdf74f397a8a9359d9625fc2238e Mon Sep 17 00:00:00 2001 From: FuelBoard Contributor Date: Tue, 11 Aug 2026 19:41:46 +0100 Subject: [PATCH] Distance change is local-only: no re-fetch (full-UK cache already covers 5/10/15 miles) --- FuelBoard/ContentView.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/FuelBoard/ContentView.swift b/FuelBoard/ContentView.swift index f427cc6..bac33a9 100644 --- a/FuelBoard/ContentView.swift +++ b/FuelBoard/ContentView.swift @@ -156,9 +156,12 @@ struct ContentView: View { // No re-fetch needed — one response carries E5/E10/DIESEL prices. WidgetCenter.shared.reloadAllTimelines() } - .onChange(of: stationLimit) { _, _ in - // Search radius changed (miles) — cached stations may not cover it. - Task { await refresh(force: true) } + .onChange(of: stationLimit) { _, newValue in + // Distance filter is LOCAL math now — the cache holds the full-UK + // dump, so changing 5/10/15 miles never needs a network fetch. + // sortedStations/radiusScopedStations recompute on the next render. + FuelStore.saveStationLimit(newValue) + WidgetCenter.shared.reloadAllTimelines() } .onChange(of: alertsEnabled) { _, newValue in FuelStore.saveAlertsEnabled(newValue)