Skip to content

Conversation

@malinajirka
Copy link
Contributor

@malinajirka malinajirka commented Dec 2, 2025

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:

  • Made selectedDetails nullable in WooPosOrdersState.Content
  • Updated search logic to set selectedDetails to null when search returns no results or errors
  • Enhanced UI to show skeleton during search and empty state when no order is selected
  • Improved selection preservation logic in replaceOrders to handle cases where no order is currently selected

Test Steps

  1. Open POS Orders screen with existing orders displayed
  2. Select any order to view its details in the right pane
  3. Use search to find orders that exist - verify selection is preserved if the selected order is in results, or first result is selected if not
  4. Use search with a query that returns no results (e.g., "xyz123")
  5. Verify the right pane shows "No order selected." with an empty state icon instead of the previous order details
  6. Search again for orders that exist - verify the first result is automatically selected
  7. Test search errors by temporarily disconnecting network - verify right pane shows empty state

Images/gif

Screen.Recording.2025-12-02.at.15.48.26.mov
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@malinajirka malinajirka requested a review from Copilot December 2, 2025 16:25
@malinajirka malinajirka added this to the 23.9 milestone Dec 2, 2025
Copilot finished reviewing on behalf of malinajirka December 2, 2025 16:28
Copy link
Contributor

Copilot AI left a 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 selectedDetails nullable in WooPosOrdersState.Content to 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.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 2, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit5be504a
Direct Downloadwoocommerce-wear-prototype-build-pr15051-5be504a.apk

@malinajirka malinajirka requested a review from toupper December 2, 2025 16:39
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 2, 2025

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

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit5be504a
Direct Downloadwoocommerce-prototype-build-pr15051-5be504a.apk

@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 63.63636% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.67%. Comparing base (d62c547) to head (5be504a).

Files with missing lines Patch % Lines
.../android/ui/woopos/orders/WooPosOrdersViewModel.kt 60.00% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##              trunk   #15051   +/-   ##
=========================================
  Coverage     38.66%   38.67%           
  Complexity    10362    10362           
=========================================
  Files          2168     2168           
  Lines        123004   123009    +5     
  Branches      16977    16981    +4     
=========================================
+ Hits          47561    47573   +12     
+ Misses        70638    70629    -9     
- Partials       4805     4807    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…-state-for-empty-search

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosOrdersScreen.kt
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosOrdersState.kt
#	WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/orders/WooPosOrdersViewModelTest.kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants