-
Notifications
You must be signed in to change notification settings - Fork 136
[WOOMOB-1583] Fix POS orders split view to show empty state when search returns no results #15051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
[WOOMOB-1583] Fix POS orders split view to show empty state when search returns no results #15051
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an issue where the POS orders split view incorrectly displayed stale order details when search returned no results. The fix makes selectedDetails nullable in the state and properly sets it to null when searches fail or return empty results.
Key Changes:
- Made
selectedDetailsnullable inWooPosOrdersState.Contentto support "no order selected" scenarios - Enhanced search error and empty result handling to clear selected details
- Updated UI to display appropriate states: order details when selected, loading skeleton during search, and empty state when no order is selected
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| WooPosOrdersState.kt | Changed selectedDetails from non-null to nullable type to support empty selection state |
| WooPosOrdersViewModel.kt | Updated search logic to set selectedDetails to null on error/empty results, and enhanced selection preservation in replaceOrders |
| WooPosOrdersScreen.kt | Added conditional rendering logic to show empty state, loading skeleton, or order details based on state; added preview function |
| WooPosOrdersLoadingState.kt | Changed OrderDetailsLoadingPane visibility from private to public for reuse in search scenarios |
| strings.xml | Added new string resource for "No order selected" message |
| WooPosOrdersViewModelTest.kt | Updated all tests to handle nullable selectedDetails and added comprehensive tests for search scenarios including empty results and selection preservation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosOrdersScreen.kt
Show resolved
Hide resolved
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosOrdersScreen.kt
Show resolved
Hide resolved
| val loadedItems = content.items as WooPosOrdersState.Content.Items.Loaded | ||
| val selectedItem = loadedItems.items.keys.first { it.isSelected } | ||
| assertThat(selectedItem.id).isEqualTo(5L) | ||
| } |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test coverage: The implementation sets selectedDetails to null when a search error occurs (ViewModel line 358), but there's no test to verify this behavior. Consider adding a test similar to given search returns no results, when search performed, then selectedDetails is null but for the error case to ensure selectedDetails is properly set to null when SearchOrdersResult.Error is returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e066ac4897afd483ec6dd90cc26e00198a9764a6
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #15051 +/- ##
=========================================
Coverage 38.61% 38.62%
Complexity 10312 10312
=========================================
Files 2163 2163
Lines 122674 122679 +5
Branches 16934 16938 +4
=========================================
+ Hits 47366 47379 +13
+ Misses 70503 70494 -9
- Partials 4805 4806 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes WOOMOB-1583
Description
Fixed an issue in the POS orders split view where empty search results would continue displaying the previously selected order details instead of showing an empty state. The right pane now properly displays "No order selected." when search returns no results, while preserving existing selection behavior for successful searches.
Key Changes:
selectedDetailsnullable inWooPosOrdersState.ContentselectedDetailstonullwhen search returns no results or errorsreplaceOrdersto handle cases where no order is currently selectedTest Steps
Images/gif
Screen.Recording.2025-12-02.at.15.48.26.mov
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.