From 9f3d10c83d0ca86dffb88dbcae4fbb5bb1041af9 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Tue, 15 Sep 2026 16:55:32 -0500 Subject: [PATCH] Refresh the status screen when the CGM's sensor session changes A CGM status highlight can change without a glucose reading to refresh the HUD: a sensor paired, expired or failed. Reload when cgmHasValidSensorSession changes, as is done for the alert muter. --- .../StatusTableViewController.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Loop/View Controllers/StatusTableViewController.swift b/Loop/View Controllers/StatusTableViewController.swift index 6f1c61a2d..050f2118d 100644 --- a/Loop/View Controllers/StatusTableViewController.swift +++ b/Loop/View Controllers/StatusTableViewController.swift @@ -177,6 +177,19 @@ final class StatusTableViewController: LoopChartsTableViewController { } } .store(in: &cancellables) + + // A CGM's session starting or ending changes its status highlight + // without a glucose reading to refresh the HUD. + deviceManager.$cgmHasValidSensorSession + .removeDuplicates() + .dropFirst() + .sink { _ in + Task { @MainActor in + self.refreshContext.update(with: .status) + await self.reloadData(animated: true) + } + } + .store(in: &cancellables) loopManager.$lastLoopCompleted .receive(on: DispatchQueue.main)