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}
/>
<h5>{i18n.t("search")}</h5>
{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 && <span>{i18n.t("no_results")}</span>}
<Paginator page={this.state.page} onChange={this.handlePageChange} />
{this.selects}
{this.searchForm}
{this.displayResults(type)}
{this.resultsCount === 0 && !this.state.searchLoading && (
<span>{i18n.t("no_results")}</span>
)}
<Paginator page={page} onChange={this.handlePageChange} />
</div>
);
}
@ -988,8 +985,8 @@ export class Search extends Component<any, SearchState> {
}
checkFinishedLoading() {
if (this.state.searchResponse && this.state.resolveObjectResponse) {
this.setState({ loading: false });
if (this.state.searchResponse || this.state.resolveObjectResponse) {
this.setState({ searchLoading: false });
}
}
}