This repository has been archived by the owner on Feb 4, 2025. It is now read-only.
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: woocommerce/woocommerce-android#12491
Description
This PR fixes an issue that prevented loading more orders (stopped the pagination) when scrolling the orders list after a certain time.
On the previous version of the orders list screen, we always refreshed the orders list when entering the screen. This behavior ensured that we always had fresh data when displaying the screen.
The order pagination saves the current list state in the local DB. Because the list state is saved in the local DB, there could be times when the app saved an intermediary state, for example, Fetching the first page, and the app closed before the final state was saved (can-load-more or fetched). To prevent inconsistent states on the
getListState
function, a timeout was added to check for more than 1 minute states. If the state was older than 1 minute, the function returned aneed-to-refresh state.
We changed the always refreshed orders list with the background tasks project. Now, we rely more on cached data on the local DB, meaning that final states (can-load-more, fetched) can live longer than 1 minute.
This PR updates the
getListState
logic so the timeout does not affect final states. The plan is that on Woo, we will implement the logic to expire these final states.Testing
It is better to test this PR with the Woo PR