From 6cfbfa20b5835e0f5cc3bf27885bdcd506521f2e Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Mon, 1 Oct 2018 12:50:21 -0700 Subject: [PATCH] Revert "Handle the case where `positions` might be an empty object to begin with" This reverts commit f8544ed12696c7a6e8186241a5912a8d7eb9e8af. --- js/components/WindowManager.js | 10 +++++----- js/reducers/windows.ts | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/js/components/WindowManager.js b/js/components/WindowManager.js index 3189e11b..43576839 100644 --- a/js/components/WindowManager.js +++ b/js/components/WindowManager.js @@ -63,7 +63,7 @@ class WindowManager extends React.Component { y: Math.ceil(offsetTop + (globalOffsetTop + offset)) }; }); - this.props.updateWindowPositions(windowPositions, false); + this.props.updateWindowPositions(windowPositions); } else { // A layout has been suplied. We will compute the bounding box and // center the given layout. @@ -87,7 +87,7 @@ class WindowManager extends React.Component { {} ); - this.props.updateWindowPositions(newPositions, false); + this.props.updateWindowPositions(newPositions); } this.props.windowsHaveBeenCentered(); }; @@ -171,7 +171,7 @@ class WindowManager extends React.Component { return diff; }, {}); - this.props.updateWindowPositions(windowPositionDiff, false); + this.props.updateWindowPositions(windowPositionDiff); }; const removeListeners = () => { @@ -228,8 +228,8 @@ const mapStateToProps = state => ({ const mapDispatchToProps = dispatch => { return { - updateWindowPositions: (positions, centered) => - dispatch(updateWindowPositions(positions, centered)), + updateWindowPositions: positions => + dispatch(updateWindowPositions(positions)), windowsHaveBeenCentered: () => dispatch(windowsHaveBeenCentered()) }; }; diff --git a/js/reducers/windows.ts b/js/reducers/windows.ts index bf075f6a..e30158a8 100644 --- a/js/reducers/windows.ts +++ b/js/reducers/windows.ts @@ -198,11 +198,10 @@ const windows = ( } return { ...w, ...serializedW }; }), - // Note: We iterate genWindows here, since the positions object may be empty - positions: objectMap(state.genWindows, (position, windowId) => { + positions: objectMap(state.positions, (position, windowId) => { const serializedPosition = serializedPositions[windowId]; if (serializedPosition == null) { - return state.positions[windowId]; + return position; } return serializedPosition; }),