From 3251a055c22615bb50857e365bd24bfb663f3052 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 31 Jan 2019 10:15:27 +0100 Subject: [PATCH 1/2] allow LoggedInView to override collapseLhs by updating prop through the dispatcher instead of having it's own state that is OR'ed in. before the state couldn't override the prop and you couldn't expand the left panel anymore when MatrixChat decided your viewport was too narrow --- src/components/structures/LoggedInView.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index ddfcbd1570..3024677388 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -164,9 +164,11 @@ const LoggedInView = React.createClass({ const collapseConfig = { toggleSize: 260 - 50, onCollapsed: (collapsed) => { - this.setState({collapseLhs: collapsed}); if (collapsed) { + dis.dispatch({action: "hide_left_panel"}, true); window.localStorage.setItem("mx_lhs_size", '0'); + } else { + dis.dispatch({action: "show_left_panel"}, true); } }, onResized: (size) => { @@ -540,7 +542,7 @@ const LoggedInView = React.createClass({
From 0450f432674c0e8460154eb7bf12fa1a956e62c1 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 31 Jan 2019 10:19:05 +0100 Subject: [PATCH 2/2] clarify how lhs collapsed state is stored --- src/components/structures/MatrixChat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 161a0fa984..9f3db9b531 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -161,7 +161,7 @@ export default React.createClass({ // If we're trying to just view a user ID (i.e. /user URL), this is it viewUserId: null, - + // this is persisted as mx_lhs_size, loaded in LoggedInView collapseLhs: false, collapsedRhs: window.localStorage.getItem("mx_rhs_collapsed") === "true", leftDisabled: false,