Skip to content

Conversation

staskus
Copy link
Contributor

@staskus staskus commented Sep 11, 2025

WOOMOB-1136

Description

Orders List

Adopting the same type of error, empty, and inline errors as the Items list. For reusability:

  • Renamed to POSListEmptyView, POSListErrorView, POSListInlineErrorView`, and made a few refactoring for reusability.
  • Made a compact version of POSListInlineErrorView since it has to fit in a narrower list.

Steps to reproduce

Test POS with:

  • Site with no POS orders, confirm a list and details show an empty state
  • No network(error) when opening POS orders, confirm a list shows error and details show an empty state
  • No network(error) when doing PTR or Pagination, confirm an inline error is shown
  • Empty view when searching for non-existent orders

Testing information

Tested on iPad Air 26 simulator

Screenshots

Simulator Screenshot - iPad Air 13-inch (M3) - 2025-09-11 at 22 42 24 Simulator Screenshot - iPad Air 13-inch (M3) - 2025-09-11 at 22 37 46 Simulator Screenshot - iPad Air 13-inch (M3) - 2025-09-11 at 22 37 31 No Orders - Search Empty View
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@staskus staskus added this to the 23.3 milestone Sep 11, 2025
@staskus staskus added type: task An internally driven task. feature: POS labels Sep 11, 2025
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 11, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16122-b6996cd
Version23.2
Bundle IDcom.automattic.alpha.woocommerce
Commitb6996cd
Installation URL1bbt32uphtgb8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@joshheald joshheald self-assigned this Sep 15, 2025
Copy link
Contributor

@joshheald joshheald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected, thanks.

A few small suggestions inline... and a bigger one:

On the main item list, if we get a failure to load the first page, we show a full-screen error view. That's a bit of a pain to do in the code, but I do think it looks better than showing an error only in the left hand pane.

Do you think we should do the same thing here? If not, what benefit do we get from keeping the split view?

orderListModel.ordersController.selectOrder(order)
}) {
OrderRowView(order: order, isSelected: orderListModel.ordersController.selectedOrder?.id == order.id)
VStack(spacing: POSSpacing.small) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a VStack needed here? I don't think it ever has more than one view in it.

That said, Group can be weird, so as a container it might be the best option. Not sure why we'd need a spacing setting, though?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right, we don't need any container for these views here. 👍

Comment on lines 87 to 114
InfiniteScrollView(
triggerDeterminer: infiniteScrollTriggerDeterminer,
loadMore: {
guard case .loaded(_, let hasMoreItems) = ordersViewState, hasMoreItems else { return }
await orderListModel.ordersController.loadNextOrders()
},
content: {
LazyVStack(spacing: POSSpacing.small) {
headerRows

let orders = ordersViewState.orders
ForEach(orders, id: \.id) { order in
Button(action: {
orderListModel.ordersController.selectOrder(order)
}) {
OrderRowView(order: order, isSelected: orderListModel.ordersController.selectedOrder?.id == order.id)
}
.buttonStyle(PlainButtonStyle())
}
.buttonStyle(PlainButtonStyle())
.animation(.default, value: orders.first?.id)

footerRows
}
.animation(.default, value: orders.first?.id)
.padding(.horizontal)
.padding(.bottom, POSPadding.medium)
}

footerRows
}
.padding(.horizontal)
)
.scrollDismissesKeyboard(.immediately)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps consider extracting this to a subview for readability now...

@@ -385,6 +389,23 @@ final class PointOfSalePreviewOrderListController: PointOfSaleSearchingOrderList
func clearSearchOrders() {}
}

final class PointOfSaleConfigurablePreviewOrderListController: PointOfSaleSearchingOrderListControllerProtocol {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
final class PointOfSaleConfigurablePreviewOrderListController: PointOfSaleSearchingOrderListControllerProtocol {
final class POSConfigurablePreviewOrderListController: POSSearchingOrderListControllerProtocol {

}
}

struct PointOfSaleItemListEmptyViewModel: POSListEmptyViewModelProtocol {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
struct PointOfSaleItemListEmptyViewModel: POSListEmptyViewModelProtocol {
struct POSListEmptyViewModel: POSListEmptyViewModelProtocol {

@staskus
Copy link
Contributor Author

staskus commented Sep 15, 2025

@joshheald, thanks for the review!

On the main item list, if we get a failure to load the first page, we show a full-screen error view. That's a bit of a pain to do in the code, but I do think it looks better than showing an error only in the left hand pane.

Yes, that could definitely be done; we could keep things consistent across the app.

@staskus staskus force-pushed the woomob-1136-woo-poshistorical-orders-order-list-empty-loading-and-error branch from 4cc899a to b8ef8ca Compare September 15, 2025 13:54
@staskus staskus enabled auto-merge September 15, 2025 13:55
@staskus staskus merged commit 3cbee10 into trunk Sep 15, 2025
14 checks passed
@staskus staskus deleted the woomob-1136-woo-poshistorical-orders-order-list-empty-loading-and-error branch September 15, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: POS type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants