Override when already set with default (#2283)

This commit is contained in:
Erik Jan de Wit 2022-03-29 11:23:26 +02:00 committed by GitHub
parent 5a0a84f724
commit f3798324a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,6 +53,7 @@ import { UserProfileTab } from "./user-profile/UserProfileTab";
import useIsFeatureEnabled, { Feature } from "../utils/useIsFeatureEnabled"; import useIsFeatureEnabled, { Feature } from "../utils/useIsFeatureEnabled";
import { ClientPoliciesTab, toClientPolicies } from "./routes/ClientPolicies"; import { ClientPoliciesTab, toClientPolicies } from "./routes/ClientPolicies";
import { KeysTab } from "./keys/KeysTab"; import { KeysTab } from "./keys/KeysTab";
import { DEFAULT_LOCALE } from "../i18n";
type RealmSettingsHeaderProps = { type RealmSettingsHeaderProps = {
onChange: (value: boolean) => void; onChange: (value: boolean) => void;
@ -186,6 +187,9 @@ export const RealmSettingsTabs = ({
const setupForm = (r: RealmRepresentation = realm) => { const setupForm = (r: RealmRepresentation = realm) => {
convertToFormValues(r, setValue); convertToFormValues(r, setValue);
if (r.supportedLocales?.length === 0) {
setValue("supportedLocales", [DEFAULT_LOCALE]);
}
resetForm(getValues()); resetForm(getValues());
}; };