From a9d4b59ab9ee0b6e712b8c4922fb6e556827b842 Mon Sep 17 00:00:00 2001
From: Camille Villa <cvilla100@gmail.com>
Date: Mon, 11 Mar 2019 11:28:45 -0700
Subject: [PATCH] Allow multiple default companion windows

Co-Authored-By: Chris Beer <chris@cbeer.info>
---
 src/state/actions/window.js            | 2 +-
 src/state/reducers/companionWindows.js | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/state/actions/window.js b/src/state/actions/window.js
index 706c5af7c..b966c2dca 100644
--- a/src/state/actions/window.js
+++ b/src/state/actions/window.js
@@ -37,7 +37,7 @@ export function addWindow(options) {
     view: 'single',
     maximized: false,
   };
-  return { type: ActionTypes.ADD_WINDOW, window: { ...defaultOptions, ...options }, companionWindow: { id: cwDefault, position: 'left', content: 'info' } };
+  return { type: ActionTypes.ADD_WINDOW, window: { ...defaultOptions, ...options }, companionWindows: [{ id: cwDefault, position: 'left', content: 'info' }] };
 }
 
 /**
diff --git a/src/state/reducers/companionWindows.js b/src/state/reducers/companionWindows.js
index a221bf97d..e3d43b980 100644
--- a/src/state/reducers/companionWindows.js
+++ b/src/state/reducers/companionWindows.js
@@ -10,7 +10,10 @@ export function companionWindowsReducer(state = {}, action) {
       return setIn(state, [action.id], action.payload);
 
     case ActionTypes.ADD_WINDOW:
-      return setIn(state, [action.companionWindow.id], action.companionWindow);
+      return action.companionWindows.reduce((newState, cw) => {
+        newState[cw.id] = cw; // eslint-disable-line no-param-reassign
+        return newState;
+      }, state);
 
     case ActionTypes.UPDATE_COMPANION_WINDOW:
       return updateIn(state, [action.id], orig => merge(orig, action.payload));
-- 
GitLab