mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-01 01:59:56 +00:00
Merge pull request #1589 from LemmyNet/double-search
Fix search request being called twice on search page
This commit is contained in:
commit
0866296f2c
1 changed files with 6 additions and 2 deletions
|
@ -332,7 +332,9 @@ export class Search extends Component<any, SearchState> {
|
|||
}
|
||||
|
||||
async componentDidMount() {
|
||||
if (!this.state.isIsomorphic) {
|
||||
if (
|
||||
!(this.state.isIsomorphic || this.props.history.location.state?.searched)
|
||||
) {
|
||||
const promises = [this.fetchCommunities()];
|
||||
if (this.state.searchText) {
|
||||
promises.push(this.search());
|
||||
|
@ -1095,7 +1097,9 @@ export class Search extends Component<any, SearchState> {
|
|||
sort: sort ?? urlSort,
|
||||
};
|
||||
|
||||
this.props.history.push(`/search${getQueryString(queryParams)}`);
|
||||
this.props.history.push(`/search${getQueryString(queryParams)}`, {
|
||||
searched: true,
|
||||
});
|
||||
|
||||
await this.search();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue