Skip to content

Commit 267e69a

Browse files
committed
Perform fetch after setting the predicate to make sure the results are updated before table view reload.
1 parent 2c58be0 commit 267e69a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

WooCommerce/Classes/ViewRelated/Search/SearchViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,11 @@ private extension SearchViewController {
433433
let searchResultsPredicate = searchUICommand.searchResultsPredicate(keyword: keyword)
434434
let subpredicates = [resultsPredicate].compactMap { $0 } + [searchResultsPredicate].compactMap { $0 }
435435
resultsController.predicate = NSCompoundPredicate(andPredicateWithSubpredicates: subpredicates)
436+
do {
437+
try resultsController.performFetch()
438+
} catch {
439+
ServiceLocator.crashLogging.logError(error)
440+
}
436441

437442
tableView.setContentOffset(.zero, animated: false)
438443
tableView.reloadData()

0 commit comments

Comments
 (0)