From c459da5d23b771664e3f2720336c007fc3cf6357 Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Wed, 3 Dec 2025 14:51:39 +0100 Subject: [PATCH] feat: update mq field handling in AnnuncioEditForm for improved data parsing --- apps/infoalloggi/src/forms/FormEditAnnuncio.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/infoalloggi/src/forms/FormEditAnnuncio.tsx b/apps/infoalloggi/src/forms/FormEditAnnuncio.tsx index e78261d..dc0aae5 100644 --- a/apps/infoalloggi/src/forms/FormEditAnnuncio.tsx +++ b/apps/infoalloggi/src/forms/FormEditAnnuncio.tsx @@ -161,6 +161,7 @@ export const AnnuncioEditForm = ({ data }: { data: AnnunciWithMedia }) => { const defaultValues: FormValues = { ...data, + mq: Number(data.mq) || null, email: data.email || undefined, }; @@ -1261,6 +1262,8 @@ export const AnnuncioEditForm = ({ data }: { data: AnnunciWithMedia }) => { name="mq" render={({ field }) => { const { value, onChange, ...rest } = field; + const mqValue = + typeof value === "string" ? parseFloat(value) : value; return (
@@ -1273,7 +1276,7 @@ export const AnnuncioEditForm = ({ data }: { data: AnnunciWithMedia }) => { decimalScale={2} {...rest} decimalSeparator="," - defaultValue={value || undefined} + defaultValue={mqValue || undefined} fixedDecimalScale id="mq" min={0}