[Glitch] Fix "You might be interested in" flashing while searching in web UI

Port f932cc9b26 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
lolsob-rspec
Eugen Rochko 2021-05-06 02:11:43 +02:00 committed by Claire
parent e4e80bf363
commit 096deaad7a
2 changed files with 8 additions and 1 deletions

View File

@ -32,6 +32,7 @@ export function submitSearch() {
const value = getState().getIn(['search', 'value']);
if (value.length === 0) {
dispatch(fetchSearchSuccess({ accounts: [], statuses: [], hashtags: [] }, ''));
return;
}

View File

@ -33,6 +33,12 @@ class SearchResults extends ImmutablePureComponent {
}
}
componentDidUpdate () {
if (this.props.searchTerm === '') {
this.props.fetchSuggestions();
}
}
handleLoadMoreAccounts = () => this.props.expandSearch('accounts');
handleLoadMoreStatuses = () => this.props.expandSearch('statuses');
@ -42,7 +48,7 @@ class SearchResults extends ImmutablePureComponent {
render () {
const { intl, results, suggestions, dismissSuggestion, searchTerm } = this.props;
if (results.isEmpty() && !suggestions.isEmpty()) {
if (searchTerm === '' && !suggestions.isEmpty()) {
return (
<div className='drawer--results'>
<div className='trends'>