Skip to content
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

[Woo POS] Variation pagination #14849

Merged
merged 5 commits into from
Jan 13, 2025
Merged

Conversation

joshheald
Copy link
Contributor

@joshheald joshheald commented Jan 10, 2025

Part of: #14696

Description

This PR adds pagination support for variations in POS.

The feature works fully, but I think we can iterate on it a little in a future PR. There's a lot of duplication between the initial sync and next page sync – from a quick experiment, we could remove the initial sync and rely on defaults, especially since there's a separate resync function for PTR.

Steps to reproduce

Open the POS, and select a variable product to open.
Note that the first page is loaded, and if you have enough variations, scrolling down will load subsequent pages until all variations are loaded.

Testing information

N.B. The page size is still 100 in this PR; in #14843 it will be reduced to 25.

For testing, I recommend reducing it to 15 so you can see more pages loaded. If you choose too small a number that doesn't fill the screen, the scroll observation to trigger next page load won't work.

Additionally, variations will only show up if you're using WC 9.6, which is not yet released. You can work around this by commenting out ProductsRemote line 214, so that the root products list is not filtered to simple products only.

//            ParameterKey.productType: POSConstants.productType,

Screenshots

variation.pagination.mp4

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

@joshheald joshheald added type: task An internally driven task. feature: POS labels Jan 10, 2025
@joshheald joshheald added this to the 21.5 milestone Jan 10, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 10, 2025

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr14849-3b33919
Version21.4
Bundle IDcom.automattic.alpha.woocommerce
Commit3b33919
App Center BuildWooCommerce - Prototype Builds #12498
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@joshheald joshheald requested a review from jaclync January 10, 2025 17:15
@joshheald joshheald marked this pull request as ready for review January 10, 2025 17:15
joshheald and others added 2 commits January 10, 2025 17:24
The switch statement now requires that newly added POSItems are specifically handled.
@jaclync
Copy link
Contributor

jaclync commented Jan 13, 2025

Works great! :shipit: I noticed an infinite scroll issue from the trigger state which I will fix separately.

The feature works fully, but I think we can iterate on it a little in a future PR. There's a lot of duplication between the initial sync and next page sync – from a quick experiment, we could remove the initial sync and rely on defaults, especially since there's a separate resync function for PTR.

I agree, the initial load could just use the PTR resync IMO. The difference between initial load and reload seems to be just resetting the internal states in the reload, which works for the initial load as well. I will try including this in the PTR work next.

@jaclync jaclync enabled auto-merge January 13, 2025 03:04
@@ -85,7 +86,7 @@ public final class PointOfSaleItemService: PointOfSaleItemServiceProtocol {
variationID: variation.productVariationID))
}),
// TODO-14696: pagination support for variations lists
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we can remove this TODO comment now

Copy link
Contributor

Choose a reason for hiding this comment

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

Update: removed in 3b33919.

@jaclync jaclync merged commit 4fa07ca into trunk Jan 13, 2025
12 checks passed
@jaclync jaclync deleted the issue/14696-variation-pagination branch January 13, 2025 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: POS type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants