Wait for the search term before searching

Fixes #1189
This commit is contained in:
Ray Schamp 2017-02-20 11:08:36 -05:00
parent 0313346fed
commit 405763246d

View file

@ -51,14 +51,16 @@ var Search = injectIntl(React.createClass({
while (term.indexOf('&') > -1) {
term = term.substring(0, term.indexOf('&'));
}
term = term.split('+').join(' ');
this.getSearchMore();
this.props.dispatch(navigationActions.setSearchTerm(decodeURI(term)));
term = decodeURI(term.split('+').join(' '));
this.props.dispatch(navigationActions.setSearchTerm(term));
},
componentDidUpdate: function (nextProps) {
if (this.props.searchTerm !== nextProps.searchTerm) this.getSearchMore();
},
getSearchMore: function () {
var termText = '';
if (this.props.searchTerm !== '') {
termText = '&q=' + this.props.searchTerm;
termText = '&q=' + encodeURIComponent(this.props.searchTerm.split(' ').join('+'));
}
api({
uri: '/search/' + this.props.tab +