fix(UpdateOidcModal): do not update slug when changing name of existing provider
This commit is contained in:
@@ -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} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user