krz/hutch
an ios client for sourcehut
clone: git clone https://gitbay.org/krz/hutch.git
ad108c76d062099af9e698e1f0ba0d8cecfeab1f
verified · cmc
author: Christian Cleberg <hello@cleberg.net> · 2026-07-16T06:16:39Z
Hutch/Views/Repositories/RepositoryListViewModel.swift | 5 ++++- Hutch/Views/Repositories/RepositorySettingsViewModel.swift | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) @@ -189,7 +189,10 @@ final class RepositoryListViewModel { filteredResults = [] } } else { - let repositories = try await fetchAllRepositories(useCache: true) + // forceRefresh used to reach only the build statuses, so a pull to + // refresh re-served the cached list and a deleted repository stayed + // on screen. + let repositories = try await fetchAllRepositories(useCache: !forceRefresh) updateSearchIndex(with: repositories) filteredResults = repositories } @@ -231,6 +231,11 @@ final class RepositorySettingsViewModel { variables: ["id": repositoryId], responseType: DeleteRepositoryResponse.self ) + // The list and Home are both served from cache, so without this the + // repository lingers on screen after it no longer exists. Creation + // already does this; deletion never did. + await client.invalidateCache(prefix: APICacheKeys.prefix(service.rawValue, "repositories")) + await client.invalidateCache(prefix: APICacheKeys.prefix("home")) didDelete = true } catch { self.error = error.userFacingMessage