From 587c9d94704b1e3a8b056013e53ed089d65c8bb9 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Mon, 3 Jul 2023 12:22:19 +0200 Subject: [PATCH] unregister fields on mapper type switch (#21361) fixes: #21358 --- js/apps/admin-ui/src/identity-providers/add/AddMapper.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/apps/admin-ui/src/identity-providers/add/AddMapper.tsx b/js/apps/admin-ui/src/identity-providers/add/AddMapper.tsx index 6121c97317..eefddb5e8f 100644 --- a/js/apps/admin-ui/src/identity-providers/add/AddMapper.tsx +++ b/js/apps/admin-ui/src/identity-providers/add/AddMapper.tsx @@ -47,7 +47,9 @@ export type Role = RoleRepresentation & { export default function AddMapper() { const { t } = useTranslation("identity-providers"); - const form = useForm(); + const form = useForm({ + 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) {