Skip to content

Commit 98f92c7

Browse files
committed
Fetch only relevant products in order details
1 parent f2fadad commit 98f92c7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

WooCommerce/Classes/ViewModels/Order Details/OrderDetailsResultsControllers.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ final class OrderDetailsResultsControllers {
2424
/// Product ResultsController.
2525
///
2626
private lazy var productResultsController: ResultsController<StorageProduct> = {
27-
let predicate = NSPredicate(format: "siteID == %lld", siteID)
27+
let productIDs = order.items.map { $0.productID }
28+
let predicate = NSPredicate(format: "siteID == %lld AND productID IN %@", siteID, productIDs)
2829
let descriptor = NSSortDescriptor(key: "name", ascending: true)
2930

3031
return ResultsController<StorageProduct>(storageManager: storageManager, matching: predicate, sortedBy: [descriptor])

0 commit comments

Comments
 (0)