From 3145c5f20de69e42c7cefb981b12ba9814dddae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frane=20Poli=C4=87?= <16856471+fPolic@users.noreply.github.com> Date: Fri, 28 Mar 2025 08:59:44 +0100 Subject: [PATCH] fix(dashboard): trim some product create inputs to prevent creation error (#12004) * fix: trim some inputs to prevent creation error * chore: changeset --- .changeset/fresh-windows-lay.md | 5 +++++ .../dashboard/src/routes/products/product-create/utils.ts | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/fresh-windows-lay.md diff --git a/.changeset/fresh-windows-lay.md b/.changeset/fresh-windows-lay.md new file mode 100644 index 0000000000..0bfe93d115 --- /dev/null +++ b/.changeset/fresh-windows-lay.md @@ -0,0 +1,5 @@ +--- +"@medusajs/dashboard": patch +--- + +fix(dashboard): product create trim inputs diff --git a/packages/admin/dashboard/src/routes/products/product-create/utils.ts b/packages/admin/dashboard/src/routes/products/product-create/utils.ts index d2f8ad59ae..848e7c67b3 100644 --- a/packages/admin/dashboard/src/routes/products/product-create/utils.ts +++ b/packages/admin/dashboard/src/routes/products/product-create/utils.ts @@ -27,15 +27,15 @@ export const normalizeProductFormValues = ( shipping_profile_id: values.shipping_profile_id || undefined, categories: values.categories.map((id) => ({ id })), type_id: values.type_id || undefined, - handle: values.handle || undefined, + handle: values.handle?.trim(), origin_country: values.origin_country || undefined, material: values.material || undefined, mid_code: values.mid_code || undefined, hs_code: values.hs_code || undefined, thumbnail, - title: values.title, - subtitle: values.subtitle || undefined, - description: values.description || undefined, + title: values.title.trim(), + subtitle: values.subtitle?.trim(), + description: values.description?.trim(), discountable: values.discountable || undefined, width: values.width ? parseFloat(values.width) : undefined, length: values.length ? parseFloat(values.length) : undefined,