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:
parent
6c76cff2a0
commit
bfd4c3bcfd
2 changed files with 2 additions and 3 deletions
|
@ -39,7 +39,7 @@ const executeFetchSubCount = (claimIdCsv: string) => (dispatch: Dispatch, getSta
|
||||||
const subCounts = result;
|
const subCounts = result;
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.FETCH_SUB_COUNT_COMPLETED,
|
type: ACTIONS.FETCH_SUB_COUNT_COMPLETED,
|
||||||
data: { claimIdCsv, subCounts, fetchDate: now },
|
data: { claimIds, subCounts, fetchDate: now },
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
|
@ -47,11 +47,10 @@ export const statsReducer = handleActions(
|
||||||
}),
|
}),
|
||||||
|
|
||||||
[ACTIONS.FETCH_SUB_COUNT_COMPLETED]: (state, action) => {
|
[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 subCountById = Object.assign({}, state.subCountById);
|
||||||
const subCountLastFetchedById = Object.assign({}, state.subCountLastFetchedById);
|
const subCountLastFetchedById = Object.assign({}, state.subCountLastFetchedById);
|
||||||
const claimIds = claimIdCsv.split(',');
|
|
||||||
let dataChanged = false;
|
let dataChanged = false;
|
||||||
|
|
||||||
if (claimIds.length === subCounts.length) {
|
if (claimIds.length === subCounts.length) {
|
||||||
|
|
Loading…
Reference in a new issue