Skip to content

Commit d512e25

Browse files
committed
persist search filter over being hidden
1 parent 65d9333 commit d512e25

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

‎src/components/structures/SearchBox.js‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,21 @@ module.exports = React.createClass({
2929
onSearch: React.PropTypes.func,
3030
},
3131

32-
onChange: new rate_limited_func(
32+
getInitialState: function() {
33+
return {
34+
searchTerm: "",
35+
};
36+
},
37+
38+
onChange: function() {
39+
if (!this.refs.search) return;
40+
this.setState({ searchTerm: this.refs.search.value });
41+
this.onSearch();
42+
},
43+
44+
onSearch: new rate_limited_func(
3345
function() {
34-
if (this.refs.search) {
35-
this.props.onSearch(this.refs.search.value);
36-
}
46+
this.props.onSearch(this.refs.search.value);
3747
},
3848
100
3949
),
@@ -81,6 +91,7 @@ module.exports = React.createClass({
8191
type="text"
8292
ref="search"
8393
className="mx_SearchBox_search"
94+
value={ this.state.searchTerm }
8495
onChange={ this.onChange }
8596
placeholder="Search room names"
8697
/>

0 commit comments

Comments
 (0)