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] don't set loading state for pull to refresh #15079

Merged

Conversation

joshheald
Copy link
Contributor

@joshheald joshheald commented Feb 6, 2025

Closes: #14869
Merge after: #15077

Description

This PR stops us adding a ghost/skeleton cell to the bottom of the item list when we pull to refresh.

When we pull to refresh, the built in controller shows a loading indicator. Previously, we set our state to loading, so we also showed a ghost cell at the bottom of the list.

On a pull to refresh, it’s unlikely that the list is going to get longer – more likely, the full first page of results will be shown, so it’ll be the same length or shorter.

Previously we had to put our refreshable modifiers higher in the heirarchy than the views they were refreshing, because we changed the state to loading when we pulled to refresh. This change of state cancelled the pull to refresh network task. Now we can group the refreshable control more closely with the list view it relates to.

Steps to reproduce

This is easiest to test with a small page size, since you can see whether there's a ghost cell on PTR without scrolling down, then triggering the load next page and (correctly) showing a ghost cell for that. However, if the items don't fill the screen the next page load won't trigger. You can use the dynamic type to get around that.

  1. Launch the app and open POS
  2. Pull to refresh
  3. Observe that the ghost cell is not shown
  4. Load more pages
  5. Pull to refresh
  6. Observe that the refresh worked as expected.

Testing information

Screenshots

pull.to.refresh.without.ghosts.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.

When we pull to refresh, the built in controller shows a loading indicator.

If we set our state to `loading`, we also showed a ghost cell at the bottom of the list.

On a pull to refresh, it’s unlikely that the list is going to get longer – more likely, the full first page of results will be shown, so it’ll be the same length or shorter.

This commit prevents us from showing the ghost cell on refresh.
Previously we had to put our refreshable modifiers higher in the heirarchy than the views they were refreshing, because we changed the state to `loading` when we pulled to refresh. This change of state cancelled the pull to refresh network task.

The state change for refresh was removed in 01cfd95fbd01e45e4a63982390787ab00bd15e84, and now we can group the refreshable control more closely with the list view it relates to.
@joshheald joshheald added type: task An internally driven task. feature: POS labels Feb 6, 2025
@joshheald joshheald added this to the 21.7 milestone Feb 6, 2025
@joshheald joshheald requested review from staskus, iamgabrielma and jaclync and removed request for staskus and iamgabrielma February 6, 2025 11:59
@joshheald joshheald changed the base branch from trunk to issue/14869-hide-cancellation-errors-from-the-user February 6, 2025 11:59
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Feb 6, 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 Numberpr15079-2c19458
Version21.6
Bundle IDcom.automattic.alpha.woocommerce
Commit2c19458
App Center BuildWooCommerce - Prototype Builds #12859
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

…o issue/14869-don't-set-loading-state-for-pull-to-refresh
…o issue/14869-don't-set-loading-state-for-pull-to-refresh
@joshheald joshheald marked this pull request as ready for review February 6, 2025 12:24
…o issue/14869-don't-set-loading-state-for-pull-to-refresh
Base automatically changed from issue/14869-hide-cancellation-errors-from-the-user to trunk February 6, 2025 15:58
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 21.7. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

Copy link
Contributor

@jaclync jaclync left a comment

Choose a reason for hiding this comment

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

Thank you for making this change! This has been bothering me mildly, as this happens easily for variation list with few variations. 🚀

@joshheald joshheald enabled auto-merge February 7, 2025 07:30
@joshheald joshheald merged commit 9068893 into trunk Feb 7, 2025
11 of 12 checks passed
@joshheald joshheald deleted the issue/14869-don't-set-loading-state-for-pull-to-refresh branch February 7, 2025 07:51
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.

[Woo POS] Avoid triggering dashboard view redraws whenever any POS aggregate model property changes
4 participants