From a2d6dacbe468a7a907a9a3b095688ab9a70ec155 Mon Sep 17 00:00:00 2001 From: Andrew P Maney Date: Tue, 17 Mar 2020 13:14:43 +0200 Subject: [PATCH] Settings: change setSettings action to merge with state. It was overriding state before. --- src/store/actions.ts | 2 +- src/store/reducers.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/store/actions.ts b/src/store/actions.ts index f382fe3..72be410 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -213,7 +213,7 @@ export const clearErros = createAction( // FIXME: Move the rest to their own file export const setSettings = createAction( 'SET_SETTINGS', - (settings: SettingsType) => { + (settings: Partial) => { return { ...settings }; } ); diff --git a/src/store/reducers.ts b/src/store/reducers.ts index e1b0cdb..59e8c15 100644 --- a/src/store/reducers.ts +++ b/src/store/reducers.ts @@ -276,8 +276,8 @@ export interface SettingsType { export const settingsReducer = handleActions( { - [actions.setSettings.toString()]: (_state: {key: string | null}, action: any) => ( - { ...action.payload } + [actions.setSettings.toString()]: (state: { key: string | null }, action: any) => ( + { ...state, ...action.payload } ), }, { locale: 'en-gb' }