Skip to content

Commit 577ee8e

Browse files
committed
Update selectedOrder when new orders are fetched
1 parent 4d02048 commit 577ee8e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

WooCommerce/Classes/POS/Controllers/PointOfSaleOrderListController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ protocol PointOfSaleSearchingOrderListControllerProtocol: PointOfSaleOrderListCo
123123

124124
ordersViewState = allOrders.isEmpty ? .empty : .loaded(allOrders, hasMoreItems: pagedOrders.hasMorePages)
125125

126+
if let selectedOrderID = selectedOrder?.id,
127+
let updatedSelectedOrder = allOrders.first(where: { $0.id == selectedOrderID }) {
128+
selectedOrder = updatedSelectedOrder
129+
}
130+
126131
if fetchStrategy.supportsCaching {
127132
cachedOrders = allOrders
128133
}

WooCommerce/WooCommerceTests/POS/Mocks/MockPOSReceiptController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class MockPOSReceiptSender: POSReceiptSending {
1616
sendReceiptWasCalled = true
1717
sendReceiptCalledWithOrderID = orderID
1818
sendReceiptCalledWithEmail = recipientEmail
19-
19+
2020
if let sendReceiptErrorToThrow {
2121
throw sendReceiptErrorToThrow
2222
}

0 commit comments

Comments
 (0)