Make search work from pages other than Discover
This commit is contained in:
parent
124b2b9a18
commit
b75004c5f6
1 changed files with 14 additions and 6 deletions
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue