Get rid of "No Results" showing while search is still loading. (#997)

This commit is contained in:
SleeplessOne1917 2023-05-04 01:47:37 +00:00 committed by Dessalines
parent a2bcc37008
commit 8fe83a2594

View file

@ -368,16 +368,13 @@ export class Search extends Component<any, SearchState> {
path={this.context.router.route.match.url} path={this.context.router.route.match.url}
/> />
<h5>{i18n.t("search")}</h5> <h5>{i18n.t("search")}</h5>
{this.selects()} {this.selects}
{this.searchForm()} {this.searchForm}
{this.state.type_ == SearchType.All && this.all()} {this.displayResults(type)}
{this.state.type_ == SearchType.Comments && this.comments()} {this.resultsCount === 0 && !this.state.searchLoading && (
{this.state.type_ == SearchType.Posts && this.posts()} <span>{i18n.t("no_results")}</span>
{this.state.type_ == SearchType.Communities && this.communities()} )}
{this.state.type_ == SearchType.Users && this.users()} <Paginator page={page} onChange={this.handlePageChange} />
{this.state.type_ == SearchType.Url && this.posts()}
{this.resultsCount() == 0 && <span>{i18n.t("no_results")}</span>}
<Paginator page={this.state.page} onChange={this.handlePageChange} />
</div> </div>
); );
} }
@ -988,8 +985,8 @@ export class Search extends Component<any, SearchState> {
} }
checkFinishedLoading() { checkFinishedLoading() {
if (this.state.searchResponse && this.state.resolveObjectResponse) { if (this.state.searchResponse || this.state.resolveObjectResponse) {
this.setState({ loading: false }); this.setState({ searchLoading: false });
} }
} }
} }