From 32b359b3f1ee06bf023c62b6703a0e8f45fece0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bj=C3=B6rkert?= Date: Thu, 16 Jul 2026 15:29:22 +0200 Subject: [PATCH] Restore Loop forecast after a refresh clears it refresh() clears predictionData and redraws an empty forecast, but the Loop forecast is only rebuilt when a newer loop cycle arrives (previousLastLoopTime < lastLoopTime). Since the current cycle has already been seen at that point, the forecast stays blank until the pump clock advances. Also rebuild when predictionData is empty so the next device-status poll restores the forecast regardless of cycle timing. --- LoopFollow/Controllers/Nightscout/DeviceStatusLoop.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LoopFollow/Controllers/Nightscout/DeviceStatusLoop.swift b/LoopFollow/Controllers/Nightscout/DeviceStatusLoop.swift index 771fdc68d..d3fe72e3b 100644 --- a/LoopFollow/Controllers/Nightscout/DeviceStatusLoop.swift +++ b/LoopFollow/Controllers/Nightscout/DeviceStatusLoop.swift @@ -68,7 +68,7 @@ extension MainViewController { let prediction = predictdata["values"] as! [Double] Observable.shared.predictionText.value = Localizer.toDisplayUnits(String(Int(round(prediction.last!)))) Observable.shared.predictionColor.value = .purple - if Storage.shared.downloadPrediction.value, previousLastLoopTime < lastLoopTime { + if Storage.shared.downloadPrediction.value, previousLastLoopTime < lastLoopTime || predictionData.isEmpty { predictionData.removeAll() var predictionTime = lastLoopTime let toLoad = Int(Storage.shared.predictionToLoad.value * 12)