From 3ef93e28ab375f8060362e11b274c59b4d844ebb Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 29 Jul 2018 21:36:44 -0700 Subject: [PATCH] Reset hidden state when opening window Fixes #626 --- js/components/WindowManager.js | 12 +----------- js/reducers/windows.js | 7 +++++-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/js/components/WindowManager.js b/js/components/WindowManager.js index c2f9330f..4ea4fa40 100644 --- a/js/components/WindowManager.js +++ b/js/components/WindowManager.js @@ -132,17 +132,7 @@ class WindowManager extends React.Component { ) }; - let box; - try { - box = boundingBox(moving); - } catch (err) { - console.error( - `Could not construct bounding box for key: ${key}. moving.length is: ${ - moving.length - }` - ); - throw err; - } + const box = boundingBox(moving); const handleMouseMove = ee => { const proposedDiff = { diff --git a/js/reducers/windows.js b/js/reducers/windows.js index 34a1376d..6e4cf34d 100644 --- a/js/reducers/windows.js +++ b/js/reducers/windows.js @@ -77,13 +77,16 @@ const windows = (state = defaultWindowsState, action) => { } }; case TOGGLE_WINDOW: + const windowState = state.genWindows[action.windowId]; return { ...state, genWindows: { ...state.genWindows, [action.windowId]: { - ...state.genWindows[action.windowId], - open: !state.genWindows[action.windowId].open + ...windowState, + open: !windowState.open, + // Reset hidden state when opening window + hidden: windowState.open ? windowState.hidden : false } } };