From c054c88e4e646b22ca23f64c6e1b0038673413ee Mon Sep 17 00:00:00 2001 From: Sergey Khliustin Date: Tue, 24 Jan 2023 14:41:11 +0100 Subject: [PATCH] Fixed build list performance issue --- .../Sources/BuildioLogic/Factory/ViewModelFactory.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Modules/BuildioLogic/Sources/BuildioLogic/Factory/ViewModelFactory.swift b/Modules/BuildioLogic/Sources/BuildioLogic/Factory/ViewModelFactory.swift index 46370e1..a7d6323 100644 --- a/Modules/BuildioLogic/Sources/BuildioLogic/Factory/ViewModelFactory.swift +++ b/Modules/BuildioLogic/Sources/BuildioLogic/Factory/ViewModelFactory.swift @@ -62,12 +62,11 @@ public final class ViewModelFactory { } public func build(_ build: BuildResponseItemModel) -> BuildViewModel { - // TODO: Double check - let model = cached(key: "BuildViewModel_\(build.slug)", model: BuildViewModel(tokenManager, build: build)) - if build.status != .running { - model.value = build + if build.status == .running { + return cached(key: "BuildViewModel_\(build.slug)", model: BuildViewModel(tokenManager, build: build)) + } else { + return BuildViewModel(tokenManager, build: build) } - return model } public func logs(_ build: BuildResponseItemModel) -> LogsViewModel {