From 65412ee9818bf251fd5caac231746b04c7eca23f Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Thu, 16 Jul 2026 10:13:46 -0500 Subject: fix: honor forceRefresh for projects and system status on the dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit loadDashboard(forceRefresh:) fanned the flag out to five loaders, but loadProjects and loadSystemStatusSnapshot dropped it: they called fetchProjects() and snapshotResult() with no policy, so pull-to-refresh returned cached projects and status while the other three sections refreshed. SonarCloud flagged both params as unused (swift:S1172). Thread forceRefresh through ProjectService.fetchProjects into the page policy (refreshIgnoringCache when forced), and pass it to snapshotResult, which already accepted it. ProjectsListView carried the same latent bug via its own .refreshable — fixed there too now that fetchProjects can force. --- Hutch/Networking/ProjectService.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Hutch/Networking/ProjectService.swift') diff --git a/Hutch/Networking/ProjectService.swift b/Hutch/Networking/ProjectService.swift index 44320ca..91dc339 100644 --- a/Hutch/Networking/ProjectService.swift +++ b/Hutch/Networking/ProjectService.swift @@ -269,15 +269,15 @@ struct ProjectService: Sendable { self.client = client } - func fetchProjects() async throws -> [Project] { - try await fetchProjectSummaries().map(Self.makeSummaryProject) + func fetchProjects(forceRefresh: Bool = false) async throws -> [Project] { + try await fetchProjectSummaries(forceRefresh: forceRefresh).map(Self.makeSummaryProject) } func fetchProjectDetail(rid: String) async throws -> Project { try await fetchProjectDetailPayload(rid: rid) } - private func fetchProjectSummaries() async throws -> [ProjectSummaryPayload] { + private func fetchProjectSummaries(forceRefresh: Bool) async throws -> [ProjectSummaryPayload] { var results: [ProjectSummaryPayload] = [] var cursor: String? @@ -295,7 +295,7 @@ struct ProjectService: Sendable { cacheKey: APICacheKeys.projects(cursor: cursor), resourceType: .userProfile, ttl: APICacheTTLs.projectList, - policy: .cacheFirstThenRefresh + policy: forceRefresh ? .refreshIgnoringCache : .cacheFirstThenRefresh ) let response = cached.value -- cgit v1.2.3