diff --git a/apps/admin-ui/src/clients/keys/SamlKeysDialog.tsx b/apps/admin-ui/src/clients/keys/SamlKeysDialog.tsx index bfde90f7d4..ca1f43f50f 100644 --- a/apps/admin-ui/src/clients/keys/SamlKeysDialog.tsx +++ b/apps/admin-ui/src/clients/keys/SamlKeysDialog.tsx @@ -1,7 +1,7 @@ import { useState } from "react"; import { saveAs } from "file-saver"; import { useTranslation } from "react-i18next"; -import { FormProvider, useForm } from "react-hook-form"; +import { FormProvider, useForm } from "react-hook-form-v7"; import { AlertVariant, Button, @@ -75,10 +75,10 @@ export const SamlKeysDialog = ({ const { t } = useTranslation("clients"); const [type, setType] = useState(false); const [keys, setKeys] = useState(); - const form = useForm(); + const form = useForm({ mode: "onChange" }); const { handleSubmit, - formState: { isDirty }, + formState: { isValid }, } = form; const { adminClient } = useAdminClient(); @@ -132,7 +132,7 @@ export const SamlKeysDialog = ({ key="confirm" data-testid="confirm" variant="primary" - isDisabled={!isDirty && !keys} + isDisabled={!isValid && !keys} onClick={() => { if (type) { handleSubmit(submit)(); @@ -181,9 +181,7 @@ export const SamlKeysDialog = ({ - - {!type && ( -
+ {!type && ( -
- )} + )} + {type && }