persist search filter over being hidden

pull/1431/head
Matthew Hodgson 2016-04-17 00:28:33 +01:00
parent 65d9333104
commit d512e25cca
1 changed files with 15 additions and 4 deletions

View File

@ -29,11 +29,21 @@ module.exports = React.createClass({
onSearch: React.PropTypes.func,
},
onChange: new rate_limited_func(
getInitialState: function() {
return {
searchTerm: "",
};
},
onChange: function() {
if (!this.refs.search) return;
this.setState({ searchTerm: this.refs.search.value });
this.onSearch();
},
onSearch: new rate_limited_func(
function() {
if (this.refs.search) {
this.props.onSearch(this.refs.search.value);
}
this.props.onSearch(this.refs.search.value);
},
100
),
@ -81,6 +91,7 @@ module.exports = React.createClass({
type="text"
ref="search"
className="mx_SearchBox_search"
value={ this.state.searchTerm }
onChange={ this.onChange }
placeholder="Search room names"
/>