fix(UpdateOidcModal): do not update slug when changing name of existing provider

This commit is contained in:
Michael Thomas
2025-05-26 20:37:23 -04:00
parent 55870fed20
commit 7d426f0c7e

View File

@@ -58,15 +58,16 @@ interface EditOidcModalProps {
onOk: () => void;
}
function SlugField(props: FieldAttributes<unknown>) {
function SlugField(props: FieldAttributes<unknown> & { readOnly?: boolean }) {
const {
values: { name },
setFieldValue,
} = useFormikContext<Partial<OidcProvider>>();
useEffect(() => {
setFieldValue(props.name, name?.toLowerCase().replace(/\s/g, '-'));
}, [props.name, name, setFieldValue]);
if (!props.readOnly)
setFieldValue(props.name, name?.toLowerCase().replace(/\s/g, '-'));
}, [props.name, props.readOnly, name, setFieldValue]);
return <Field {...props} />;
}