Skip to content
Snippets Groups Projects
Unverified Commit 20fe4091 authored by Jack Reed's avatar Jack Reed Committed by GitHub
Browse files

Merge pull request #3166 from ProjectMirador/cwState

Don't mutate companionWindow state
parents 23eaa14b 21e66684
No related branches found
No related tags found
No related merge requests found
......@@ -10,10 +10,17 @@ export function companionWindowsReducer(state = {}, action) {
return setIn(state, [action.id], action.payload);
case ActionTypes.ADD_WINDOW:
return action.companionWindows.reduce((newState, cw) => {
newState[cw.id] = { ...cw, windowId: action.id }; // eslint-disable-line no-param-reassign
return {
...state,
...((action.companionWindows || []).reduce((newState, cw) => {
newState[cw.id] = { // eslint-disable-line no-param-reassign
...state[cw.id],
...cw,
windowId: action.id,
};
return newState;
}, state);
}, {})),
};
case ActionTypes.REMOVE_WINDOW:
return Object.keys(state).reduce((object, key) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment