mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 12:21:13 +00:00
Fix 502 error on initial settings page load. (#2498)
- Needed to wrap the fetchThemeList in an isBrowser check. - Fixes #2497
This commit is contained in:
parent
e3a11648c9
commit
18c3f3975f
1 changed files with 16 additions and 9 deletions
|
@ -67,7 +67,12 @@ import { PersonListing } from "./person-listing";
|
||||||
import { InitialFetchRequest } from "../../interfaces";
|
import { InitialFetchRequest } from "../../interfaces";
|
||||||
import TotpModal from "../common/totp-modal";
|
import TotpModal from "../common/totp-modal";
|
||||||
import { LoadingEllipses } from "../common/loading-ellipses";
|
import { LoadingEllipses } from "../common/loading-ellipses";
|
||||||
import { refreshTheme, setThemeOverride, snapToTop } from "../../utils/browser";
|
import {
|
||||||
|
isBrowser,
|
||||||
|
refreshTheme,
|
||||||
|
setThemeOverride,
|
||||||
|
snapToTop,
|
||||||
|
} from "../../utils/browser";
|
||||||
import { getHttpBaseInternal } from "../../utils/env";
|
import { getHttpBaseInternal } from "../../utils/env";
|
||||||
import { IRoutePropsWithFetch } from "../../routes";
|
import { IRoutePropsWithFetch } from "../../routes";
|
||||||
import { RouteComponentProps } from "inferno-router/dist/Route";
|
import { RouteComponentProps } from "inferno-router/dist/Route";
|
||||||
|
@ -349,16 +354,18 @@ export class Settings extends Component<SettingsRouteProps, SettingsState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async componentWillMount() {
|
async componentWillMount() {
|
||||||
this.setState({ themeList: await fetchThemeList() });
|
if (isBrowser()) {
|
||||||
|
this.setState({ themeList: await fetchThemeList() });
|
||||||
|
|
||||||
if (!this.state.isIsomorphic) {
|
if (!this.state.isIsomorphic) {
|
||||||
this.setState({
|
this.setState({
|
||||||
instancesRes: LOADING_REQUEST,
|
instancesRes: LOADING_REQUEST,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
instancesRes: await HttpService.client.getFederatedInstances(),
|
instancesRes: await HttpService.client.getFederatedInstances(),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue