Skip to content

Commit 4466258

Browse files
authored
Merge pull request #5825 from woocommerce/fix/3821-orders-tab-placeholder-showing-sample-data
Orders tab: fix sample data shown in placeholder view after switching tabs
2 parents 878b4e4 + 2e17a09 commit 4466258

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

WooCommerce/Classes/ViewRelated/Orders/OrderListViewController.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ final class OrderListViewController: UIViewController {
158158
//
159159
// We can remove this once we've replaced XLPagerTabStrip.
160160
tableView.reloadData()
161+
162+
restartPlaceholderAnimation()
161163
}
162164

163165
/// Returns a function that creates cells for `dataSource`.
@@ -410,7 +412,7 @@ private extension OrderListViewController {
410412
// let's reset the state before using it again
411413
ghostableTableView.removeGhostContent()
412414
ghostableTableView.displayGhostContent(options: options,
413-
style: .wooDefaultGhostStyle)
415+
style: Constants.ghostStyle)
414416
ghostableTableView.startGhostAnimation()
415417
ghostableTableView.isHidden = false
416418
}
@@ -423,6 +425,14 @@ private extension OrderListViewController {
423425
ghostableTableView.removeGhostContent()
424426
}
425427

428+
/// After returning to the screen, `restartGhostAnimation` is required to resume ghost animation.
429+
func restartPlaceholderAnimation() {
430+
guard ghostableTableView.isHidden == false else {
431+
return
432+
}
433+
ghostableTableView.restartGhostAnimation(style: Constants.ghostStyle)
434+
}
435+
426436
/// Shows the EmptyStateViewController
427437
///
428438
func displayEmptyViewController() {
@@ -675,4 +685,8 @@ private extension OrderListViewController {
675685
case results
676686
case empty
677687
}
688+
689+
enum Constants {
690+
static let ghostStyle: GhostStyle = .wooDefaultGhostStyle
691+
}
678692
}

0 commit comments

Comments
 (0)