Skip to content

Commit 94617ec

Browse files
committed
Make CellViewModel.name optional for easier UI handling
1 parent 1e2380b commit 94617ec

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

WooCommerce/Classes/ViewRelated/Search/Order/OrderSearchStarterViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ extension OrderSearchStarterViewController: UITableViewDataSource {
6868
let cellViewModel = viewModel.cellViewModel(at: indexPath)
6969

7070
cell.accessoryType = .disclosureIndicator
71-
cell.updateUI(title: cellViewModel.name, value: cellViewModel.total)
71+
cell.updateUI(title: cellViewModel.name ?? "", value: cellViewModel.total)
7272

7373
return cell
7474
}

WooCommerce/Classes/ViewRelated/Search/Order/OrderSearchStarterViewModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class OrderSearchStarterViewModel {
1717
/// The `ViewModel` containing only the data used by the displayed cell.
1818
///
1919
struct CellViewModel {
20-
let name: String
20+
let name: String?
2121
let slug: String
2222
/// The total displayed on the right side.
2323
///
@@ -85,7 +85,7 @@ extension OrderSearchStarterViewModel {
8585

8686
let total = NumberFormatter.localizedUpToNinetyNine(orderStatus.total)
8787

88-
return CellViewModel(name: orderStatus.name ?? "",
88+
return CellViewModel(name: orderStatus.name,
8989
slug: orderStatus.slug,
9090
total: total)
9191
}

0 commit comments

Comments
 (0)