From 5f02cd5fb90ba6be16b6902a193dedc03303517a Mon Sep 17 00:00:00 2001 From: jonat75 Date: Mon, 11 Dec 2023 10:38:43 +0100 Subject: [PATCH] fix: radio component validation trigger (#1916) --- packages/app/src/components/RHF/RadioOuiNon.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/app/src/components/RHF/RadioOuiNon.tsx b/packages/app/src/components/RHF/RadioOuiNon.tsx index 5dd91ad10..1893ad02e 100644 --- a/packages/app/src/components/RHF/RadioOuiNon.tsx +++ b/packages/app/src/components/RHF/RadioOuiNon.tsx @@ -27,10 +27,10 @@ export const RadioOuiNon = ({ legend, name, disabled, triggerValidation = false value: "oui", ...field, onChange: e => { + field.onChange(e); // Inform RHF to update its state. if (triggerValidation) { trigger(); // Rerun validation to set isValid and errors. } - field.onChange(e); // Inform RHF to update its state. }, }, }, @@ -40,10 +40,10 @@ export const RadioOuiNon = ({ legend, name, disabled, triggerValidation = false value: "non", ...field, onChange: e => { + field.onChange(e); // Inform RHF to update its state. if (triggerValidation) { trigger(); // Rerun validation to set isValid and errors. } - field.onChange(e); // Inform RHF to update its state. }, }, },