Fix sub-count reducer incorrectly rejecting data

We skip fetching IDs that were just fetched a moment ago, so the array size will be reduced, but the reducer was still expecting all items to be fetched, hence the array size mismatch
This commit is contained in:
infinite-persistence 2022-03-01 22:25:52 +08:00 committed by Thomas Zarebczan
parent 6c76cff2a0
commit bfd4c3bcfd
2 changed files with 2 additions and 3 deletions

View file

@ -39,7 +39,7 @@ const executeFetchSubCount = (claimIdCsv: string) => (dispatch: Dispatch, getSta
const subCounts = result;
dispatch({
type: ACTIONS.FETCH_SUB_COUNT_COMPLETED,
data: { claimIdCsv, subCounts, fetchDate: now },
data: { claimIds, subCounts, fetchDate: now },
});
})
.catch((error) => {

View file

@ -47,11 +47,10 @@ export const statsReducer = handleActions(
}),
[ACTIONS.FETCH_SUB_COUNT_COMPLETED]: (state, action) => {
const { claimIdCsv, subCounts, fetchDate } = action.data;
const { claimIds, subCounts, fetchDate } = action.data;
const subCountById = Object.assign({}, state.subCountById);
const subCountLastFetchedById = Object.assign({}, state.subCountLastFetchedById);
const claimIds = claimIdCsv.split(',');
let dataChanged = false;
if (claimIds.length === subCounts.length) {