Make search work from pages other than Discover

This commit is contained in:
Alex Liebowitz 2016-08-22 09:14:56 -04:00
parent 124b2b9a18
commit b75004c5f6

View file

@ -206,17 +206,25 @@ var DiscoverPage = React.createClass({
componentDidUpdate: function() { componentDidUpdate: function() {
if (this.props.query != this.state.query) if (this.props.query != this.state.query)
{ {
this.setState({ this.handleSearchChanged();
searching: true,
query: this.props.query,
});
lbry.search(this.props.query, this.searchCallback);
} }
}, },
handleSearchChanged: function() {
this.setState({
searching: true,
query: this.props.query,
});
lbry.search(this.props.query, this.searchCallback);
},
componentDidMount: function() { componentDidMount: function() {
document.title = "Discover"; document.title = "Discover";
if (this.props.query !== '') {
// Rendering with a query already typed
this.handleSearchChanged();
}
}, },
getInitialState: function() { getInitialState: function() {