From 8fe83a2594c46051a354106cc24f468ed9df4588 Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 Date: Thu, 4 May 2023 01:47:37 +0000 Subject: [PATCH] Get rid of "No Results" showing while search is still loading. (#997) --- src/shared/components/search.tsx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/shared/components/search.tsx b/src/shared/components/search.tsx index b96e1c5c..41e95cfc 100644 --- a/src/shared/components/search.tsx +++ b/src/shared/components/search.tsx @@ -368,16 +368,13 @@ export class Search extends Component { path={this.context.router.route.match.url} />
{i18n.t("search")}
- {this.selects()} - {this.searchForm()} - {this.state.type_ == SearchType.All && this.all()} - {this.state.type_ == SearchType.Comments && this.comments()} - {this.state.type_ == SearchType.Posts && this.posts()} - {this.state.type_ == SearchType.Communities && this.communities()} - {this.state.type_ == SearchType.Users && this.users()} - {this.state.type_ == SearchType.Url && this.posts()} - {this.resultsCount() == 0 && {i18n.t("no_results")}} - + {this.selects} + {this.searchForm} + {this.displayResults(type)} + {this.resultsCount === 0 && !this.state.searchLoading && ( + {i18n.t("no_results")} + )} + ); } @@ -988,8 +985,8 @@ export class Search extends Component { } checkFinishedLoading() { - if (this.state.searchResponse && this.state.resolveObjectResponse) { - this.setState({ loading: false }); + if (this.state.searchResponse || this.state.resolveObjectResponse) { + this.setState({ searchLoading: false }); } } }