Skip to content

Commit

Permalink
Fix more issues
Browse files Browse the repository at this point in the history
  • Loading branch information
scme0 committed Jun 28, 2023
1 parent 73dbf40 commit f83cdf0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/shared/components/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,7 @@ export class Search extends Component<any, SearchState> {
}

async componentDidMount() {
if (
!(this.state.isIsomorphic || this.props.history.location.state?.searched)
) {
if (!this.state.isIsomorphic) {
const promises = [this.fetchCommunities()];
if (this.state.searchText) {
promises.push(this.search());
Expand Down Expand Up @@ -435,6 +433,12 @@ export class Search extends Component<any, SearchState> {
resolveObjectResponse = await HttpService.silent_client.resolveObject(
resolveObjectForm
);

// If we return this object with a state of failed, the catch-all-handler will redirect
// to an error page, so we ignore it by covering up the error with the empty state.
if (resolveObjectResponse.state == "failed") {
resolveObjectResponse = { state: "empty" };
}
}
}
}
Expand Down Expand Up @@ -1099,10 +1103,6 @@ export class Search extends Component<any, SearchState> {
sort: sort ?? urlSort,
};

this.props.history.push(`/search${getQueryString(queryParams)}`, {
searched: true,
});

await this.search();
this.props.history.push(`/search${getQueryString(queryParams)}`);
}
}
2 changes: 1 addition & 1 deletion src/shared/services/HttpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { LemmyHttp } from "lemmy-js-client";
import { toast } from "../toast";
import { I18NextService } from "./I18NextService";

type EmptyRequestState = {
export type EmptyRequestState = {
state: "empty";
};

Expand Down

0 comments on commit f83cdf0

Please sign in to comment.