unregister fields on mapper type switch (#21361)

fixes: #21358
This commit is contained in:
Erik Jan de Wit 2023-07-03 12:22:19 +02:00 committed by GitHub
parent 8eb631b9d9
commit 587c9d9470
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,7 +47,9 @@ export type Role = RoleRepresentation & {
export default function AddMapper() {
const { t } = useTranslation("identity-providers");
const form = useForm<IdPMapperRepresentationWithAttributes>();
const form = useForm<IdPMapperRepresentationWithAttributes>({
shouldUnregister: true,
});
const {
handleSubmit,
register,
@ -86,7 +88,7 @@ export default function AddMapper() {
id: id!,
alias: alias!,
},
{ ...identityProviderMapper, name: currentMapper?.name! }
{ ...identityProviderMapper }
);
addAlert(t("mapperSaveSuccess"), AlertVariant.success);
} catch (error) {