Skip to content

Commit 13b392e

Browse files
committed
Deep-merge configuration settings that could contain non-scalar values (like functions in the theme components).
1 parent fd75b6c commit 13b392e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/state/reducers/config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ export const configReducer = (state = initialState, action) => {
1818
case ActionTypes.SET_CONFIG:
1919
return action.config;
2020
case ActionTypes.IMPORT_MIRADOR_STATE:
21-
return action.state.config || {};
21+
return {
22+
...(action.state.config || {}),
23+
export: deepmerge(state.export || {}, action.state.config?.export || {}, { arrayMerge: overwriteMerge }),
24+
requests: deepmerge(state.requests || {}, action.state.config?.requests || {}, { arrayMerge: overwriteMerge }),
25+
theme: deepmerge(state.theme || {}, action.state.config?.theme || {}, { arrayMerge: overwriteMerge }),
26+
themes: deepmerge(state.themes || {}, action.state.config?.themes || {}, { arrayMerge: overwriteMerge }),
27+
};
2228
default:
2329
return state;
2430
}

0 commit comments

Comments
 (0)