Skip to content

Commit

Permalink
Fixed build list performance issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiikhliustin committed Jan 24, 2023
1 parent 961a9ab commit c054c88
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c054c88

Please sign in to comment.