diff options
| author | Christian Cleberg <[email protected]> | 2026-03-18 19:34:59 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-03-18 19:34:59 -0500 |
| commit | 430741f0236ab21583acda8e2774d95e6e0e4ffe (patch) | |
| tree | e8ef38d574939a0c47f2a92e14db60950b824151 /Hutch/Views/Builds/BuildDetailViewModel.swift | |
| parent | 796c39d8ff08829bd695bc4e7497a147640eb79a (diff) | |
| download | hutch-430741f0236ab21583acda8e2774d95e6e0e4ffe.tar.gz hutch-430741f0236ab21583acda8e2774d95e6e0e4ffe.tar.bz2 hutch-430741f0236ab21583acda8e2774d95e6e0e4ffe.zip | |
stabilize build task identity and log cache keys
Diffstat (limited to 'Hutch/Views/Builds/BuildDetailViewModel.swift')
| -rw-r--r-- | Hutch/Views/Builds/BuildDetailViewModel.swift | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Hutch/Views/Builds/BuildDetailViewModel.swift b/Hutch/Views/Builds/BuildDetailViewModel.swift index c14e47b..1768e47 100644 --- a/Hutch/Views/Builds/BuildDetailViewModel.swift +++ b/Hutch/Views/Builds/BuildDetailViewModel.swift @@ -104,7 +104,11 @@ final class BuildDetailViewModel { variables: ["id": jobId], responseType: JobDetailResponse.self ) - job = result.job + var loadedJob = result.job + loadedJob.tasks = loadedJob.tasks.enumerated().map { index, task in + task.withOrdinal(index) + } + job = loadedJob } catch { self.error = error.localizedDescription } @@ -113,19 +117,20 @@ final class BuildDetailViewModel { } func loadTaskLog(task: BuildTask) async { + let cacheKey = task.logCacheKey guard let log = task.log, let logURL = URL(string: log.fullURL), - !loadingTaskLogs.contains(task.name), - taskLogs[task.name] == nil else { return } - loadingTaskLogs.insert(task.name) + !loadingTaskLogs.contains(cacheKey), + taskLogs[cacheKey] == nil else { return } + loadingTaskLogs.insert(cacheKey) do { - taskLogs[task.name] = try await client.fetchText(url: logURL) + taskLogs[cacheKey] = try await client.fetchText(url: logURL) } catch { self.error = error.localizedDescription } - loadingTaskLogs.remove(task.name) + loadingTaskLogs.remove(cacheKey) } func cancelJob() async { |
