-
Notifications
You must be signed in to change notification settings - Fork 114
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] Hide cancellation errors when refreshing #15077
Merged
joshheald
merged 7 commits into
trunk
from
issue/14869-hide-cancellation-errors-from-the-user
Feb 6, 2025
Merged
[Woo POS] Hide cancellation errors when refreshing #15077
joshheald
merged 7 commits into
trunk
from
issue/14869-hide-cancellation-errors-from-the-user
Feb 6, 2025
+212
−75
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If we change the view content while the refresh is ongoing, e.g. by loading a new page, the refresh request will be cancelled. It doesn’t make sense to show that as an error to the user. Instead, we swallow that error, and set the state back to `loaded` with all the items that we’ve got up to now.
…issue/14869-hide-cancellation-errors-from-the-user
|
…issue/14869-hide-cancellation-errors-from-the-user
…issue/14869-hide-cancellation-errors-from-the-user
4 tasks
Base automatically changed from
issue/14869-use-observation-to-fix-refresh-issue
to
trunk
February 6, 2025 12:29
staskus
approved these changes
Feb 6, 2025
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.
Works well! Tested on iPad Air M2 18.2 device. Confirmed that .requestCancelled
is caught 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of: #14869
Merge after: #15060
Description
This PR prevents us showing an error when the pull to refresh network task is cancelled.
The cancellation can happen when we do something else to change the state of the item list, in particular, loading a new page.
In this case, the cancellation of the refresh is the right thing to do – we want to only complete the next page, not refresh, show the first page and add a random page to the end of the results.
Steps to reproduce
It's a bit tricky! Easier if you set your page size small.
a. The first page of results is shown (if PTR succeeded), or
b. The next page of results is shown with all previous pages above it (if PTR was cancelled)
Testing information
Screenshots
don.t.show.errors.from.cancelling.a.pull.to.refresh.mp4
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: