-
Notifications
You must be signed in to change notification settings - Fork 133
[WOOMOB-1551] Ensure trashed products disappear from local catalog after sync #14822
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-1551] Ensure trashed products disappear from local catalog after sync #14822
Conversation
Generated by 🚫 Danger |
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 ensures that products and variations with "trash" status are properly removed from the local catalog during incremental sync operations. The implementation adds support for fetching trashed items via API and upserting them to trigger proper deletion through the database's upsert mechanism.
Key changes:
- Added
includeStatusparameter to product and variation fetch APIs to support filtering by status (including trash) - During incremental sync, fetches trashed items separately and includes them in the upsert operation
- Full sync continues to exclude trash items since they're removed by deleting all local data first
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| WooPosLocalCatalogStore.kt | Added includeStatus parameter to fetch methods to enable status-based filtering |
| WooPosProductRestClient.kt | Implemented API parameter handling for include_status in product and variation requests |
| WooPosSyncVariationsAction.kt | Added logic to fetch trashed variations during incremental sync and include them in upsert |
| WooPosSyncProductsAction.kt | Added logic to fetch trashed products during incremental sync and include them in upsert |
| WooPosSyncVariationsActionTest.kt | Added test coverage for trash variation fetching behavior |
| WooPosSyncProductsActionTest.kt | Added test coverage for trash product fetching behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) | ||
| } | ||
|
|
||
| return trashVariations.toList() |
Copilot
AI
Oct 24, 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.
The toList() call is unnecessary since trashVariations is already a MutableList<WooPosVariationEntity>, which is a subtype of List. The method can directly return trashVariations.
| return trashVariations.toList() | |
| return trashVariations |
| ) | ||
| } | ||
|
|
||
| return trashProducts.toList() |
Copilot
AI
Oct 24, 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.
The toList() call is unnecessary since trashProducts is already a MutableList<WooPosProductEntity>, which is a subtype of List. The method can directly return trashProducts.
| return trashProducts.toList() | |
| return trashProducts |
📲 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.
|
Fixes WOOMOB-1551
Description
This PR ensures that trashed products and variations are properly handled during catalog synchronization. When products or variations are trashed in the backend, they now correctly disappear from the local catalog after both incremental and full sync operations.
The implementation adds support for fetching trashed products and variations during sync operations by including the
status=trashparameter in API requests. This allows the app to identify and remove trashed items from the local database.Testing information
To test this implementation:
Images/gif
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.