Skip to content

Commit d2b4679

Browse files
committed
Make sure the order is always updated
1 parent a4b5801 commit d2b4679

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Yosemite/Yosemite/Stores/OrderStore.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,12 @@ private extension OrderStore {
355355
/// Optimistically update the Status
356356
let oldStatus = updateOrderStatus(siteID: siteID, orderID: orderID, statusKey: status)
357357

358-
remote.updateOrder(from: siteID, orderID: orderID, statusKey: status) { [weak self] (_, error) in
358+
remote.updateOrder(from: siteID, orderID: orderID, statusKey: status) { [weak self] (order, error) in
359359
guard let error = error else {
360-
// NOTE: We're *not* actually updating the whole entity here. Reason: Prevent UI inconsistencies!!
361-
onCompletion(nil)
362-
return
360+
if let order = order {
361+
self?.upsertStoredOrder(readOnlyOrder: order)
362+
}
363+
return onCompletion(nil)
363364
}
364365

365366
/// Revert Optimistic Update

0 commit comments

Comments
 (0)