-
Notifications
You must be signed in to change notification settings - Fork 133
Fix order refreshing after search #12948
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
Conversation
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## trunk #12948 +/- ##
=========================================
Coverage 39.65% 39.66%
- Complexity 5949 5952 +3
=========================================
Files 1261 1261
Lines 72890 72893 +3
Branches 9973 9973
=========================================
+ Hits 28904 28910 +6
+ Misses 41413 41411 -2
+ Partials 2573 2572 -1 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
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.
Tests well!
Thanks!
Shell a test be added though?
…rs-search-refreshing
Closes: #12941
Description
This pull request addresses the issue of the PTR (Pull-to-Refresh) getting stuck in the user interface after exiting the search view while the search is still in progress.
When we subscribe to the new
pagedListWrapper
in theactivatePagedListWrapper
function, the new LiveData starts off asnull
and does not emit any value until the list changes. We also remove the previous source by callingclearLiveDataSources
. However, because_isFetchingFirstPage
is aMediatorLiveData
, it retains the last cached value. This leads to a problem: when we exit the search view and switch to the newactivatePagedListWrapper
, the screen state remains stuck in a refreshing state. This occurs because_isFetchingFirstPage
does not reflect the state of the currentactivatePagedListWrapper
(which isnull
), but rather the last cached value.To resolve this issue, I have chosen to reset the LiveData to its default values within the
clearLiveDataSources
function.I considered an alternative solution that involved adding an initial value to the PagedListWrapper LiveData. However, since this class is utilized in other projects as well, I opted for the current solution to minimize the impact on our code and prevent any regressions in those other projects.
Steps to reproduce
Testing information
The tests that have been performed
Images/gif
Screen_recording_20241118_213834.mp4
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.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: