diff --git a/js/apps/admin-ui/src/user-federation/shared/SettingsCache.tsx b/js/apps/admin-ui/src/user-federation/shared/SettingsCache.tsx index 84a6433a939..8e007058be3 100644 --- a/js/apps/admin-ui/src/user-federation/shared/SettingsCache.tsx +++ b/js/apps/admin-ui/src/user-federation/shared/SettingsCache.tsx @@ -3,7 +3,6 @@ import { SelectControl, SelectControlOption, } from "@keycloak/keycloak-ui-shared"; -import { isEqual } from "lodash-es"; import { UseFormReturn, useWatch } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { FormAccess } from "../../components/form/FormAccess"; @@ -16,6 +15,13 @@ export type SettingsCacheProps = { unWrap?: boolean; }; +const getValue = (value: string | string[] | undefined) => { + if (Array.isArray(value)) { + return value[0]; + } + return value; +}; + const CacheFields = ({ form }: { form: UseFormReturn }) => { const { t } = useTranslation(); @@ -24,6 +30,8 @@ const CacheFields = ({ form }: { form: UseFormReturn }) => { name: "config.cachePolicy", }); + const cachePolicy = getValue(cachePolicyType); + const hourOptions: SelectControlOption[] = []; let hourDisplay = ""; for (let index = 0; index < 24; index++) { @@ -65,7 +73,7 @@ const CacheFields = ({ form }: { form: UseFormReturn }) => { "NO_CACHE", ]} /> - {isEqual(cachePolicyType, ["EVICT_WEEKLY"]) ? ( + {cachePolicy === "EVICT_WEEKLY" ? ( { ]} /> ) : null} - {isEqual(cachePolicyType, ["EVICT_DAILY"]) || - isEqual(cachePolicyType, ["EVICT_WEEKLY"]) ? ( + {cachePolicy === "EVICT_DAILY" || cachePolicy === "EVICT_WEEKLY" ? ( <> ) : null} - {isEqual(cachePolicyType, ["MAX_LIFESPAN"]) ? ( + {cachePolicy === "MAX_LIFESPAN" ? (