diff --git a/packages/account/src/Components/poi/poi-confirm-with-example-form-container/poi-confirm-with-example-form-container.tsx b/packages/account/src/Components/poi/poi-confirm-with-example-form-container/poi-confirm-with-example-form-container.tsx index 651f03e19722..2feffd3ec7d8 100644 --- a/packages/account/src/Components/poi/poi-confirm-with-example-form-container/poi-confirm-with-example-form-container.tsx +++ b/packages/account/src/Components/poi/poi-confirm-with-example-form-container/poi-confirm-with-example-form-container.tsx @@ -41,6 +41,24 @@ const PoiConfirmWithExampleFormContainer = ({ }); React.useEffect(() => { + const initializeFormValues = () => { + WS.wait('get_settings').then(() => { + const visible_settings = ['first_name', 'last_name', 'date_of_birth']; + const form_initial_values = filterObjProperties(account_settings, visible_settings); + if (form_initial_values.date_of_birth) { + form_initial_values.date_of_birth = toMoment(form_initial_values.date_of_birth).format( + 'YYYY-MM-DD' + ); + } + setRestState({ + ...rest_state, + changeable_fields: getChangeableFields(), + form_initial_values, + }); + setIsLoading(false); + }); + }; + initializeFormValues(); // eslint-disable-next-line react-hooks/exhaustive-deps }, [account_settings]); @@ -101,22 +119,6 @@ const PoiConfirmWithExampleFormContainer = ({ return errors; }; - const initializeFormValues = () => { - WS.wait('get_settings').then(() => { - const visible_settings = ['first_name', 'last_name', 'date_of_birth']; - const form_initial_values = filterObjProperties(account_settings, visible_settings); - if (form_initial_values.date_of_birth) { - form_initial_values.date_of_birth = toMoment(form_initial_values.date_of_birth).format('YYYY-MM-DD'); - } - setRestState({ - ...rest_state, - changeable_fields: getChangeableFields(), - form_initial_values, - }); - setIsLoading(false); - }); - }; - const { form_initial_values: { ...form_initial_values }, api_error, diff --git a/packages/components/src/components/radio-group/radio-group.tsx b/packages/components/src/components/radio-group/radio-group.tsx index 678722f73312..d54ac1d30360 100644 --- a/packages/components/src/components/radio-group/radio-group.tsx +++ b/packages/components/src/components/radio-group/radio-group.tsx @@ -9,7 +9,7 @@ type TItemWrapper = { type TRadioGroup = { className?: string; name: string; - onToggle: (e: ChangeEvent) => void; + onToggle: (e: React.MouseEvent & { target: { value: string } }) => void; required?: boolean; selected: string; } & TItemWrapper; @@ -37,8 +37,8 @@ const RadioGroup = ({ setSelectedOption(selected); }, [selected]); - const onChange = (e: React.MouseEvent) => { - setSelectedOption(e?.target?.value); + const onChange = (e: React.MouseEvent & { target: { value: string } }) => { + setSelectedOption(e.target.value); onToggle(e); };