Merge pull request #5593 from SimonBrandner/fix-collapsing-of-left-panel

Fix saving the collapsed state of the left panel
This commit is contained in:
Michael Telatynski 2021-02-01 12:50:37 +00:00 committed by GitHub
commit 741b3f76ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -215,10 +215,12 @@ class LoggedInView extends React.Component<IProps, IState> {
_createResizer() { _createResizer() {
let size; let size;
let collapsed;
const collapseConfig: ICollapseConfig = { const collapseConfig: ICollapseConfig = {
toggleSize: 260 - 50, toggleSize: 260 - 50,
onCollapsed: (collapsed) => { onCollapsed: (_collapsed) => {
if (collapsed) { collapsed = _collapsed;
if (_collapsed) {
dis.dispatch({action: "hide_left_panel"}, true); dis.dispatch({action: "hide_left_panel"}, true);
window.localStorage.setItem("mx_lhs_size", '0'); window.localStorage.setItem("mx_lhs_size", '0');
} else { } else {
@ -233,7 +235,7 @@ class LoggedInView extends React.Component<IProps, IState> {
this.props.resizeNotifier.startResizing(); this.props.resizeNotifier.startResizing();
}, },
onResizeStop: () => { onResizeStop: () => {
window.localStorage.setItem("mx_lhs_size", '' + size); if (!collapsed) window.localStorage.setItem("mx_lhs_size", '' + size);
this.props.resizeNotifier.stopResizing(); this.props.resizeNotifier.stopResizing();
}, },
}; };