- 
                Notifications
    You must be signed in to change notification settings 
- Fork 134
[WOOMOB-1589] Replace fetching by offset with fetching by page for /products endpoint #14830
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
[WOOMOB-1589] Replace fetching by offset with fetching by page for /products endpoint #14830
Conversation
…roducts-disappear-after' into issue/woomob-1589-woo-poslocal-catalog-use-pages-instead-of-offset-for # Conflicts: # WooCommerce/src/test/kotlin/com/woocommerce/android/ui/woopos/localcatalog/WooPosSyncProductsActionTest.kt # libs/fluxc-plugin/src/main/kotlin/org/wordpress/android/fluxc/store/pos/localcatalog/WooPosLocalCatalogStore.kt
…roducts-disappear-after' into issue/woomob-1589-woo-poslocal-catalog-use-pages-instead-of-offset-for
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 migrates the /products endpoint from offset-based pagination to page-based pagination to align with the existing /variations endpoint implementation.
Key Changes:
- Replaced offset-based pagination parameters with page-based parameters throughout the products fetching flow
- Updated API client to use page numbers instead of offsets
- Consolidated pagination parameter building by reusing buildBaseParamsfor variations
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description | 
|---|---|
| WooPosProductRestClient.kt | Updated fetchProductsto use page parameter instead of offset; refactoredfetchVariationsto use sharedbuildBaseParamsmethod | 
| WooPosLocalCatalogStore.kt | Changed pagination from offset to page-based in fetchRecentlyModifiedProducts; updated next page calculation logic | 
| WooPosLocalCatalogFetchProductsResult.kt | Renamed nextOffsetfield tonextPage | 
| WooPosSyncProductsAction.kt | Updated pagination tracking from currentOffsettocurrentPage | 
| WooPosLocalCatalogStoreTest.kt | Updated all test expectations to use page-based pagination | 
| WooPosSyncProductsActionTest.kt | Updated test mocks and assertions to use page-based pagination | 
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
        
          
                ...c/test/kotlin/com/woocommerce/android/ui/woopos/localcatalog/WooPosSyncProductsActionTest.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | 📲 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. 
 | 
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.
LGTM!
…pages-instead-of-offset-for
| Codecov Report❌ Patch coverage is  
 Additional details and impacted files@@            Coverage Diff            @@
##              trunk   #14830   +/-   ##
=========================================
  Coverage     38.26%   38.27%           
- Complexity    10100    10101    +1     
=========================================
  Files          2131     2131           
  Lines        120600   120593    -7     
  Branches      16529    16528    -1     
=========================================
+ Hits          46152    46154    +2     
+ Misses        69771    69764    -7     
+ Partials       4677     4675    -2     ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
 | 
#WOOMOB-1589
Do not merge label - target branch must be trunk.
Description
Replace fetching by offset with fetching by pages to bring /products endpoint to consistency with /variations endpoint.
Test Steps
Smoke test local catalog - verify all products are fetched during full sync.
Images/gif
N/A
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.