From e126a78c125768c384c3bdcabe6ec01d4494c917 Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Sun, 5 Jul 2026 22:31:09 -0700 Subject: [PATCH] Session Cache Implementation Nucleic-Session: B2346642-3353-4BD5-9DE2-A8B77BD66C98 Co-authored-by: Nucleic --- .../NucleicRemote/Models/RemoteStore.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift index 8aab27a..422f6d0 100644 --- a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift +++ b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift @@ -598,7 +598,18 @@ final class RemoteStore: ObservableObject { /// or a representative one. No-op in demo, which seeds the aggregate directly. private func rebuildAggregate() { guard !demoMode else { return } - sessions = aggregatedSessions() + let live = aggregatedSessions() + if !live.isEmpty { + sessions = live + cachedSummaries = live + persistSummaries(live) + } else if connections.values.contains(where: { $0.connectivity.isLive }) { + // Connected, but the host genuinely has no sessions — reflect that honestly. + sessions = [] + } else { + // Offline: keep showing the saved history rather than blanking the list. + sessions = cachedSummaries + } dashboard = DashboardSnapshot.merged(connections.values.map(\.dashboard)) meshPeers = connections.values.flatMap(\.meshPeers)