claim_search: Don't clear previous page results if subsequent pages timeout.

## Issue
https://github.com/lbryio/lbry-desktop/issues/4609

## Change
- Don't clear existing results on timeout.
- Treat this scenario as "last page reached" by marking `claimSearchByQueryLastPageReached`.
This commit is contained in:
infiinte-persistence 2020-11-10 01:05:53 +08:00 committed by Sean Yesmunt
parent c86810038c
commit 8093d69807
2 changed files with 17 additions and 3 deletions

11
dist/bundle.es.js vendored
View file

@ -5155,13 +5155,20 @@ reducers[CLAIM_SEARCH_FAILED] = (state, action) => {
const { query } = action.data; const { query } = action.data;
const claimSearchByQuery = Object.assign({}, state.claimSearchByQuery); const claimSearchByQuery = Object.assign({}, state.claimSearchByQuery);
const fetchingClaimSearchByQuery = Object.assign({}, state.fetchingClaimSearchByQuery); const fetchingClaimSearchByQuery = Object.assign({}, state.fetchingClaimSearchByQuery);
const claimSearchByQueryLastPageReached = Object.assign({}, state.claimSearchByQueryLastPageReached);
delete fetchingClaimSearchByQuery[query]; delete fetchingClaimSearchByQuery[query];
claimSearchByQuery[query] = null;
if (claimSearchByQuery[query] && claimSearchByQuery[query].length !== 0) {
claimSearchByQueryLastPageReached[query] = true;
} else {
claimSearchByQuery[query] = null;
}
return Object.assign({}, state, { return Object.assign({}, state, {
fetchingClaimSearchByQuery, fetchingClaimSearchByQuery,
claimSearchByQuery claimSearchByQuery,
claimSearchByQueryLastPageReached
}); });
}; };

View file

@ -570,13 +570,20 @@ reducers[ACTIONS.CLAIM_SEARCH_FAILED] = (state: State, action: any): State => {
const { query } = action.data; const { query } = action.data;
const claimSearchByQuery = Object.assign({}, state.claimSearchByQuery); const claimSearchByQuery = Object.assign({}, state.claimSearchByQuery);
const fetchingClaimSearchByQuery = Object.assign({}, state.fetchingClaimSearchByQuery); const fetchingClaimSearchByQuery = Object.assign({}, state.fetchingClaimSearchByQuery);
const claimSearchByQueryLastPageReached = Object.assign({}, state.claimSearchByQueryLastPageReached);
delete fetchingClaimSearchByQuery[query]; delete fetchingClaimSearchByQuery[query];
claimSearchByQuery[query] = null;
if (claimSearchByQuery[query] && claimSearchByQuery[query].length !== 0) {
claimSearchByQueryLastPageReached[query] = true;
} else {
claimSearchByQuery[query] = null;
}
return Object.assign({}, state, { return Object.assign({}, state, {
fetchingClaimSearchByQuery, fetchingClaimSearchByQuery,
claimSearchByQuery, claimSearchByQuery,
claimSearchByQueryLastPageReached,
}); });
}; };