-
Notifications
You must be signed in to change notification settings - Fork 136
Fix trash product button visibility on tablets #14734
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
Fix trash product button visibility on tablets #14734
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 a bug where the "Trash product" button was not visible in split pane layout on tablets. The fix adds logic to check if the product detail view is displayed in a detail pane, enabling the trash button even when the product list is not in the backstack.
- Updated the trash button visibility logic to account for tablet split pane layout
- Added a check for detail pane context to enable trash functionality in two-pane mode
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| val productListInBackstack = | ||
| findNavController().previousBackStackEntry?.destination?.id == BottomNavigationPosition.PRODUCTS.id | ||
| val isInDetailPane = | ||
| requireContext().isTwoPanesShouldBeUsed && (parentFragment?.id == R.id.detail_nav_container) |
Copilot
AI
Oct 10, 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.
Consider using safe call operator for parentFragment property access. While the logic may be correct in this context, using parentFragment?.id followed by direct comparison could potentially lead to unexpected behavior if parentFragment is null. Consider parentFragment?.id == R.id.detail_nav_container ?: false or restructure the condition to be more explicit about null handling.
| requireContext().isTwoPanesShouldBeUsed && (parentFragment?.id == R.id.detail_nav_container) | |
| requireContext().isTwoPanesShouldBeUsed && ((parentFragment?.id == R.id.detail_nav_container) ?: false) |
📲 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.
|
hichamboushaba
left a comment
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.
Looks good, thanks for working on this @AdamGrzybkowski, and sorry for missing it too in my review of the previous PR 😅
50cc233 to
8bb2dbd
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #14734 +/- ##
=========================================
Coverage 38.43% 38.43%
- Complexity 9895 9896 +1
=========================================
Files 2109 2109
Lines 117106 117106
Branches 15657 15657
=========================================
+ Hits 45013 45015 +2
+ Misses 67921 67920 -1
+ Partials 4172 4171 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
WOOMOB-1484
Description
While fixing a bug related to the
Trash productbutton visibility (#14657) I introduced this bug where the trash button is not visible in the split pane layout.This PR adds an additional check to make sure it's enabled in split pane even if the product list is not in the backstack.
Steps to reproduce
...menu buttonTrash productis visibleTesting information
The above plus:
Using a tablet
2. Go to order
3. Tap on a product
4. Verify the
Trash productis goneUsing a phone
...menu buttonTrash productis visibleThe tests that have been performed
The above
Images/gif
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.