Revert "Handle the case where positions might be an empty object to begin with"

This reverts commit f8544ed126.
This commit is contained in:
Jordan Eldredge 2018-10-01 12:50:21 -07:00 committed by GitHub
parent 0fd5908abf
commit 6cfbfa20b5
2 changed files with 7 additions and 8 deletions

View file

@ -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())
};
};

View file

@ -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;
}),