color-scheme: fix React warning

A reducer must always return a state or null to ignore it. When the color scheme
is undefined we should return the previous state.
This commit is contained in:
Saúl Ibarra Corretgé 2019-02-12 17:52:50 +01:00 committed by Saúl Ibarra Corretgé
parent 2442ef80b0
commit 8ea693616d
1 changed files with 1 additions and 1 deletions

View File

@ -14,7 +14,7 @@ import { SET_COLOR_SCHEME } from './actionTypes';
ReducerRegistry.register('features/base/color-scheme', (state = {}, action) => {
switch (action.type) {
case SET_COLOR_SCHEME:
return _.cloneDeep(action.colorScheme);
return _.cloneDeep(action.colorScheme) || state;
}
return state;