Skip to content

Conversation

@samiuelson
Copy link
Contributor

@samiuelson samiuelson commented Nov 5, 2025

Description

This PR refactors WooPosIsLocalCatalogVariationsEndpointAvailable to execute on the IO dispatcher by making its invoke() function a suspend function. This ensures that version checking operations are performed on the background thread, because internally they query the DB.

💡 Don't merge until target is trunk

Test Steps

  • Check the code
  • Smoke test POS

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.

@samiuelson samiuelson changed the base branch from trunk to woomob-1564-woo-poslocal-catalog November 5, 2025 15:03
@samiuelson samiuelson requested a review from Copilot November 5, 2025 15:03
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 refactors WooPosIsLocalCatalogVariationsEndpointAvailable to execute on the IO dispatcher by making its invoke() function a suspend function and adding CoroutineDispatchers dependency. This ensures that version checking operations are performed on the appropriate background thread.

  • Made WooPosIsLocalCatalogVariationsEndpointAvailable.invoke() a suspend function with IO dispatcher context
  • Added CoroutineDispatchers parameter to the class constructor
  • Updated test to provide test dispatchers when constructing the class

Reviewed Changes

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

File Description
WooPosIsLocalCatalogVariationsEndpointAvailable.kt Converted invoke function to suspend, added IO dispatcher wrapping, and injected CoroutineDispatchers dependency
WooPosIsLocalCatalogSupportedTest.kt Updated test setup to provide testDispatchers to the WooPosIsLocalCatalogVariationsEndpointAvailable constructor

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import javax.inject.Inject

class WooPosIsLocalCatalogVariationsEndpointAvailable @Inject constructor(
private val getWooVersion: GetWooCorePluginCachedVersion,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getWooVersion internally queries DB on the main thread.

@samiuelson samiuelson requested a review from kidinov November 5, 2025 15:10
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 5, 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
Commitd0a183e
Direct Downloadwoocommerce-wear-prototype-build-pr14904-d0a183e.apk

@samiuelson samiuelson added category: performance Related to performance such as slow loading. Tech Debt labels Nov 5, 2025
@samiuelson samiuelson added this to the 23.7 milestone Nov 5, 2025
@samiuelson samiuelson marked this pull request as ready for review November 5, 2025 15:10
@samiuelson samiuelson added the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Nov 5, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 5, 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
Commitd0a183e
Direct Downloadwoocommerce-prototype-build-pr14904-d0a183e.apk

Base automatically changed from woomob-1564-woo-poslocal-catalog to trunk November 5, 2025 17:00
@samiuelson samiuelson removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: performance Related to performance such as slow loading. Tech Debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants