Browse Source

Fix "You might be interested in" flashing while searching in web UI (#16162)

closed-social-v3
Eugen Rochko 3 years ago
committed by GitHub
parent
commit
0a3fa034fc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions
  1. +1
    -0
      app/javascript/mastodon/actions/search.js
  2. +7
    -1
      app/javascript/mastodon/features/compose/components/search_results.js

+ 1
- 0
app/javascript/mastodon/actions/search.js 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;
}

+ 7
- 1
app/javascript/mastodon/features/compose/components/search_results.js 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='search-results'>
<div className='trends'>

Loading…
Cancel
Save