From bdc3e1173d0b5cad2b5b686f4e9face00b410b48 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 4 Feb 2019 18:51:41 +0000 Subject: [PATCH] preserve SearchBox searchTerm state when collapsing --- src/components/structures/LeftPanel.js | 7 ++++--- src/components/structures/SearchBox.js | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/structures/LeftPanel.js b/src/components/structures/LeftPanel.js index 489e9bd243..cb374a02a3 100644 --- a/src/components/structures/LeftPanel.js +++ b/src/components/structures/LeftPanel.js @@ -199,9 +199,10 @@ const LeftPanel = React.createClass({ }, ); - const searchBox = !this.props.collapsed ? - : - undefined; + const searchBox = (); return (
diff --git a/src/components/structures/SearchBox.js b/src/components/structures/SearchBox.js index ea1fa312c1..db982b0d59 100644 --- a/src/components/structures/SearchBox.js +++ b/src/components/structures/SearchBox.js @@ -97,6 +97,13 @@ module.exports = React.createClass({ render: function() { const TintableSvg = sdk.getComponent('elements.TintableSvg'); + // check for collapsed here and + // not at parent so we keep + // searchTerm in our state + // when collapsing and expanding + if (this.props.collapsed) { + return null; + } const clearButton = this.state.searchTerm.length > 0 ? (