summaryrefslogtreecommitdiff
path: root/Hutch/Networking
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-07-16 10:13:46 -0500
committerChristian Cleberg <[email protected]>2026-07-16 10:13:46 -0500
commit65412ee9818bf251fd5caac231746b04c7eca23f (patch)
tree06a6e5e26d6b00fb4c1e27587682006d21b9fd0b /Hutch/Networking
parent6a26c6de827e56a57d9a8c600b26354e280df383 (diff)
downloadhutch-65412ee9818bf251fd5caac231746b04c7eca23f.tar.gz
hutch-65412ee9818bf251fd5caac231746b04c7eca23f.tar.bz2
hutch-65412ee9818bf251fd5caac231746b04c7eca23f.zip
fix: honor forceRefresh for projects and system status on the dashboard
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.
Diffstat (limited to 'Hutch/Networking')
-rw-r--r--Hutch/Networking/ProjectService.swift8
1 files changed, 4 insertions, 4 deletions
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