From 9c5af8b61e38d458365a173ae136d1b738d314ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 29 Jan 2021 13:19:09 +0100 Subject: [PATCH] Fix collapsing of the left panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/structures/LoggedInView.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx index a6d0739313..0e52ff4c1c 100644 --- a/src/components/structures/LoggedInView.tsx +++ b/src/components/structures/LoggedInView.tsx @@ -215,10 +215,12 @@ class LoggedInView extends React.Component { _createResizer() { let size; + let collapsed; const collapseConfig: ICollapseConfig = { toggleSize: 260 - 50, - onCollapsed: (collapsed) => { - if (collapsed) { + onCollapsed: (_collapsed) => { + collapsed = _collapsed; + if (_collapsed) { dis.dispatch({action: "hide_left_panel"}, true); window.localStorage.setItem("mx_lhs_size", '0'); } else { @@ -233,7 +235,7 @@ class LoggedInView extends React.Component { this.props.resizeNotifier.startResizing(); }, onResizeStop: () => { - window.localStorage.setItem("mx_lhs_size", '' + size); + if (!collapsed) window.localStorage.setItem("mx_lhs_size", '' + size); this.props.resizeNotifier.stopResizing(); }, };