]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix "You might be interested in" flashing while searching in web UI
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 6 May 2021 00:11:43 +0000 (02:11 +0200)
committerClaire <claire.github-309c@sitedethib.com>
Fri, 7 May 2021 20:00:11 +0000 (22:00 +0200)
Port 0a3fa034fc66246dbf9dfb4627a983e0903042d4 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/flavours/glitch/actions/search.js
app/javascript/flavours/glitch/features/compose/components/search_results.js

index a025f352a501ec3f814ce29e21490b4dadc7c51a..b4aee4525d90954c700eddeabbc9e536ae20d038 100644 (file)
@@ -32,6 +32,7 @@ export function submitSearch() {
     const value = getState().getIn(['search', 'value']);
 
     if (value.length === 0) {
+      dispatch(fetchSearchSuccess({ accounts: [], statuses: [], hashtags: [] }, ''));
       return;
     }
 
index c7e225507fbd85f84bd4ef648f40c94780afe6b3..a0f86a06aa2a264fe1f33fa709870d94d281d058 100644 (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'>