From 06e4e4a5d3cfc011b840b89213c319f937b0f6b1 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sun, 5 Jul 2020 11:58:30 +0300 Subject: [PATCH] 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. --- src/journal-processors.ts | 6 +++--- src/store/actions.ts | 4 ++-- src/store/reducers.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/journal-processors.ts b/src/journal-processors.ts index 0aa6ce1..79e2dd4 100644 --- a/src/journal-processors.ts +++ b/src/journal-processors.ts @@ -5,7 +5,7 @@ import { List } from 'immutable'; import { EventType, ContactType, TaskType } from './pim-types'; import { store } from './store'; -import { addError } from './store/actions'; +import { appendError } from './store/actions'; import * as EteSync from 'etesync'; @@ -20,7 +20,7 @@ export function syncEntriesToItemMap( comp = ContactType.parse(syncEntry.content); } catch (e) { e.message = `${e.message}\nWhile processing: ${syncEntry.content}`; - store.dispatch(addError(undefined as any, e)); + store.dispatch(appendError(undefined as any, e)); return; } @@ -94,7 +94,7 @@ function syncEntriesToCalendarItemMap( comp = ItemType.parse(syncEntry.content); } catch (e) { e.message = `${e.message}\nWhile processing: ${syncEntry.content}`; - store.dispatch(addError(undefined as any, e)); + store.dispatch(appendError(undefined as any, e)); return; } diff --git a/src/store/actions.ts b/src/store/actions.ts index 0730ec0..9a3da44 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -196,8 +196,8 @@ export function fetchAll(etesync: CredentialsData, currentEntries: EntriesData) } -export const addError = createAction( - 'ADD_ERRORS', +export const appendError = createAction( + 'APPEND_ERROR', (_etesync: CredentialsData, error: Error) => { return error; } diff --git a/src/store/reducers.ts b/src/store/reducers.ts index 295ad99..da1acf1 100644 --- a/src/store/reducers.ts +++ b/src/store/reducers.ts @@ -258,7 +258,7 @@ export const errorsReducer = handleActions( return state; }, - [actions.addError.toString()]: (state: List, action: Action) => { + [actions.appendError.toString()]: (state: List, action: Action) => { return state.push(action.payload); }, [actions.clearErros.toString()]: (state: List, _action: Action) => {