Trim search query
This commit is contained in:
parent
f1f0c15548
commit
717e6c12bf
1 changed files with 5 additions and 3 deletions
|
@ -50,7 +50,7 @@ class WunderBar extends React.PureComponent {
|
|||
this._resetOnNextBlur = hasQuery;
|
||||
this._isSearchDispatchPending = false;
|
||||
if (searchQuery) {
|
||||
this.props.onSearch(searchQuery);
|
||||
this.props.onSearch(searchQuery.trim());
|
||||
}
|
||||
}, WunderBar.TYPING_TIMEOUT); // 800ms delay, tweak for faster/slower
|
||||
}
|
||||
|
@ -125,12 +125,14 @@ class WunderBar extends React.PureComponent {
|
|||
this._resetOnNextBlur = false;
|
||||
clearTimeout(this._userTypingTimer);
|
||||
|
||||
const value = this._input.value.trim();
|
||||
|
||||
try {
|
||||
uri = lbryuri.normalize(this._input.value);
|
||||
uri = lbryuri.normalize(value);
|
||||
this.setState({ value: uri });
|
||||
} catch (error) {
|
||||
//then it's not a valid URL, so let's search
|
||||
uri = this._input.value;
|
||||
uri = value;
|
||||
method = "onSearch";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue