From d123de1f36849d9448ae0e3a4ac579472712d944 Mon Sep 17 00:00:00 2001 From: Anna Viklund Date: Wed, 15 Jan 2025 11:42:55 +0100 Subject: [PATCH 1/3] fix: update form layout to avoid nested forms --- .../user-info-form/user-info-form.tsx | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/ui/src/components/header/user-info-dialog/user-info-form/user-info-form.tsx b/ui/src/components/header/user-info-dialog/user-info-form/user-info-form.tsx index d3792fffc..406bbca8e 100644 --- a/ui/src/components/header/user-info-dialog/user-info-form/user-info-form.tsx +++ b/ui/src/components/header/user-info-dialog/user-info-form/user-info-form.tsx @@ -11,6 +11,7 @@ import { useUpdateUserInfo } from 'data-services/hooks/auth/useUpdateUserInfo' import { Button, ButtonTheme } from 'design-system/components/button/button' import { IconType } from 'design-system/components/icon/icon' import { InputContent } from 'design-system/components/input/input' +import { useRef } from 'react' import { useForm } from 'react-hook-form' import { API_MAX_UPLOAD_SIZE } from 'utils/constants' import { STRING, translate } from 'utils/language' @@ -55,6 +56,7 @@ const config: FormConfig = { } export const UserInfoForm = ({ userInfo }: { userInfo: UserInfo }) => { + const formRef = useRef(null) const { control, handleSubmit, @@ -68,29 +70,28 @@ export const UserInfoForm = ({ userInfo }: { userInfo: UserInfo }) => { const errorMessage = useFormError({ error, setFieldError }) return ( -
updateUserInfo(values))}> - {errorMessage && ( - - )} + <> + {errorMessage && ( + + )} - - - - <> - + updateUserInfo(values))} + className="grid gap-8" + > + - - { )} /> - - + + +