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) { while (term.indexOf('&') > -1) {
term = term.substring(0, term.indexOf('&')); term = term.substring(0, term.indexOf('&'));
} }
term = term.split('+').join(' '); term = decodeURI(term.split('+').join(' '));
this.getSearchMore(); this.props.dispatch(navigationActions.setSearchTerm(term));
this.props.dispatch(navigationActions.setSearchTerm(decodeURI(term))); },
componentDidUpdate: function (nextProps) {
if (this.props.searchTerm !== nextProps.searchTerm) this.getSearchMore();
}, },
getSearchMore: function () { getSearchMore: function () {
var termText = ''; var termText = '';
if (this.props.searchTerm !== '') { if (this.props.searchTerm !== '') {
termText = '&q=' + this.props.searchTerm; termText = '&q=' + encodeURIComponent(this.props.searchTerm.split(' ').join('+'));
} }
api({ api({
uri: '/search/' + this.props.tab + uri: '/search/' + this.props.tab +