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:
Dessalines 2024-06-03 18:31:54 -04:00 committed by GitHub
parent e3a11648c9
commit 18c3f3975f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,7 +67,12 @@ import { PersonListing } from "./person-listing";
import { InitialFetchRequest } from "../../interfaces";
import TotpModal from "../common/totp-modal";
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 { IRoutePropsWithFetch } from "../../routes";
import { RouteComponentProps } from "inferno-router/dist/Route";
@ -349,6 +354,7 @@ export class Settings extends Component<SettingsRouteProps, SettingsState> {
}
async componentWillMount() {
if (isBrowser()) {
this.setState({ themeList: await fetchThemeList() });
if (!this.state.isIsomorphic) {
@ -361,6 +367,7 @@ export class Settings extends Component<SettingsRouteProps, SettingsState> {
});
}
}
}
componentWillUnmount(): void {
// In case `interface_language` change wasn't saved.