From b75004c5f6e52c88a91cc17828dff8a59522c8dc Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 22 Aug 2016 09:14:56 -0400 Subject: [PATCH] Make search work from pages other than Discover --- js/page/discover.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/js/page/discover.js b/js/page/discover.js index b2b189f70..ba201dd70 100644 --- a/js/page/discover.js +++ b/js/page/discover.js @@ -206,17 +206,25 @@ var DiscoverPage = React.createClass({ componentDidUpdate: function() { if (this.props.query != this.state.query) { - this.setState({ - searching: true, - query: this.props.query, - }); - - lbry.search(this.props.query, this.searchCallback); + this.handleSearchChanged(); } }, + handleSearchChanged: function() { + this.setState({ + searching: true, + query: this.props.query, + }); + + lbry.search(this.props.query, this.searchCallback); + }, + componentDidMount: function() { document.title = "Discover"; + if (this.props.query !== '') { + // Rendering with a query already typed + this.handleSearchChanged(); + } }, getInitialState: function() {