Skip to content

Conversation

samiuelson
Copy link
Contributor

@samiuelson samiuelson commented Sep 19, 2025

WOOMOB-1072

Description

The goal of this PR is to load products from the DB instead of the existing in-memory cache / remote call hybrid store. Currently, the logic that decides on which data source to use is based on the feature flag WOO_POS_LOCAL_CATALOG_M1 state.

⚠️ Known issue: WOOMOB-1370 - variations have wrong names. This will be solved in a separate PR.

Steps to reproduce

Testing information

  1. Verify that in the release build (FF disabled), the previous data source implementation is used.
  2. Verify that PTR works when FF is disabled.
  3. When the FF is enabled, verify that products load correctly - full list. They should load significantly faster without pagination.

The tests that have been performed

Above

Images/gif

N/A

  • 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.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 19, 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 Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit6ad04db
Direct Downloadwoocommerce-wear-prototype-build-pr14636-6ad04db.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 19, 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 Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit6ad04db
Direct Downloadwoocommerce-prototype-build-pr14636-6ad04db.apk

@samiuelson samiuelson changed the base branch from trunk to woomob-1069-woo-poslocal-catalog-update-ptr-behavior-fetch-products-and September 19, 2025 12:18
…tch-products-and' into woomob-1072-woo-poslocal-catalog-connect-product-list-to-pos-products
@samiuelson samiuelson added this to the 23.4 milestone Sep 19, 2025
@samiuelson samiuelson added feature: point of sale POS project type: task An internally driven task. labels Sep 19, 2025
@samiuelson samiuelson requested a review from Copilot September 19, 2025 12:22
Copy link
Contributor

@Copilot 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 integrates local database storage for the POS product catalog, controlled by the WOO_POS_LOCAL_CATALOG_M1 feature flag. When enabled, products are loaded from the local database instead of the existing cache/remote hybrid approach.

  • Adds sorting by product name (case-insensitive) at the database level
  • Introduces a new database-backed data source for products with search filtering capabilities
  • Updates product retrieval logic in cart and totals repositories to support both local catalog and legacy flows

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
WooPosProductsDao.kt Adds case-insensitive sorting by name to database query
WooPosProductsInDbDataSource.kt New data source implementation for database-backed product loading
WooPosProductsDataSourceInterface.kt Interface to unify different product data source implementations
WooPosProductsViewModel.kt Updates to use feature flag-based data source selection
WooPosTotalsRepository.kt Adds conditional product retrieval from local catalog
WooPosCartViewModel.kt Adds conditional product retrieval from local catalog
Test files Updates and new tests to support the changes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 37.07865% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.48%. Comparing base (107cdbb) to head (6ad04db).

Files with missing lines Patch % Lines
...id/ui/woopos/home/totals/WooPosTotalsRepository.kt 12.12% 27 Missing and 2 partials ⚠️
...android/ui/woopos/home/cart/WooPosCartViewModel.kt 15.78% 12 Missing and 4 partials ⚠️
...pos/home/items/products/WooPosProductsViewModel.kt 53.33% 3 Missing and 4 partials ⚠️
...os/home/items/products/WooPosProductsDataSource.kt 50.00% 3 Missing ⚠️
...ome/items/products/WooPosProductsInDbDataSource.kt 93.75% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                                              Coverage Diff                                              @@
##             woomob-1069-woo-poslocal-catalog-update-ptr-behavior-fetch-products-and   #14636      +/-   ##
=============================================================================================================
- Coverage                                                                      38.48%   38.48%   -0.01%     
- Complexity                                                                      9773     9781       +8     
=============================================================================================================
  Files                                                                           2066     2067       +1     
  Lines                                                                         115583   115657      +74     
  Branches                                                                       15402    15426      +24     
=============================================================================================================
+ Hits                                                                           44480    44506      +26     
- Misses                                                                         66969    67008      +39     
- Partials                                                                        4134     4143       +9     

☔ 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.

@samiuelson samiuelson marked this pull request as ready for review September 19, 2025 14:49
Copy link
Contributor

@Copilot 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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: point of sale POS project type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants