]> Untitled Git - lemmy-ui.git/commitdiff
Get rid of "No Results" showing while search is still loading. (#997)
authorSleeplessOne1917 <abias1122@gmail.com>
Thu, 4 May 2023 01:47:37 +0000 (01:47 +0000)
committerGitHub <noreply@github.com>
Thu, 4 May 2023 01:47:37 +0000 (21:47 -0400)
src/shared/components/search.tsx

index 53b56e8feb0269bbd766636c39d5853a4b605439..946dd6abf8ea5db1dd4758ac4ed176340d8172ef 100644 (file)
@@ -423,7 +423,9 @@ export class Search extends Component<any, SearchState> {
         {this.selects}
         {this.searchForm}
         {this.displayResults(type)}
-        {this.resultsCount === 0 && <span>{i18n.t("no_results")}</span>}
+        {this.resultsCount === 0 && !this.state.searchLoading && (
+          <span>{i18n.t("no_results")}</span>
+        )}
         <Paginator page={page} onChange={this.handlePageChange} />
       </div>
     );
@@ -1002,7 +1004,7 @@ export class Search extends Component<any, SearchState> {
   }
 
   checkFinishedLoading() {
-    if (this.state.searchResponse && this.state.resolveObjectResponse) {
+    if (this.state.searchResponse || this.state.resolveObjectResponse) {
       this.setState({ searchLoading: false });
     }
   }