Rename addError action to fix fetch count.

Fetch count increments/decrements based on all actions prefixed with add
which means addError was also triggering it.
This broke the fetchCount count.
master
Tom Hacohen 4 years ago
parent de07f76c92
commit 06e4e4a5d3

@ -5,7 +5,7 @@ import { List } from 'immutable';
import { EventType, ContactType, TaskType } from './pim-types'; import { EventType, ContactType, TaskType } from './pim-types';
import { store } from './store'; import { store } from './store';
import { addError } from './store/actions'; import { appendError } from './store/actions';
import * as EteSync from 'etesync'; import * as EteSync from 'etesync';
@ -20,7 +20,7 @@ export function syncEntriesToItemMap(
comp = ContactType.parse(syncEntry.content); comp = ContactType.parse(syncEntry.content);
} catch (e) { } catch (e) {
e.message = `${e.message}\nWhile processing: ${syncEntry.content}`; e.message = `${e.message}\nWhile processing: ${syncEntry.content}`;
store.dispatch(addError(undefined as any, e)); store.dispatch(appendError(undefined as any, e));
return; return;
} }
@ -94,7 +94,7 @@ function syncEntriesToCalendarItemMap<T extends EventType>(
comp = ItemType.parse(syncEntry.content); comp = ItemType.parse(syncEntry.content);
} catch (e) { } catch (e) {
e.message = `${e.message}\nWhile processing: ${syncEntry.content}`; e.message = `${e.message}\nWhile processing: ${syncEntry.content}`;
store.dispatch(addError(undefined as any, e)); store.dispatch(appendError(undefined as any, e));
return; return;
} }

@ -196,8 +196,8 @@ export function fetchAll(etesync: CredentialsData, currentEntries: EntriesData)
} }
export const addError = createAction( export const appendError = createAction(
'ADD_ERRORS', 'APPEND_ERROR',
(_etesync: CredentialsData, error: Error) => { (_etesync: CredentialsData, error: Error) => {
return error; return error;
} }

@ -258,7 +258,7 @@ export const errorsReducer = handleActions(
return state; return state;
}, },
[actions.addError.toString()]: (state: List<Error>, action: Action<any>) => { [actions.appendError.toString()]: (state: List<Error>, action: Action<any>) => {
return state.push(action.payload); return state.push(action.payload);
}, },
[actions.clearErros.toString()]: (state: List<Error>, _action: Action<any>) => { [actions.clearErros.toString()]: (state: List<Error>, _action: Action<any>) => {

Loading…
Cancel
Save