From 55685d3c5bcaad6b73b881f048ad91d003327fcb Mon Sep 17 00:00:00 2001 From: "gitstart-app[bot]" <57568882+gitstart-app[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 15:02:12 +0200 Subject: [PATCH] Fix currency field edition form (#6723) This PR was created by [GitStart](https://gitstart.com/) to address the requirements from this ticket: [TWNTY-6692](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-6692). This ticket was imported from: [TWNTY-6692](https://github.com/twentyhq/twenty/issues/6692) --- ### Description The problem is not related to the API, what was happening was a failure in the form validation, because in the changed file, the `currencyCode` value, which should be a string with single quotes around it, was receiving single quotes again, unnecessarily, and this affected field validation in `packages/twenty-front/src/modules/object-record/record-field/validation-schemas/currencyFieldDefaultValueSchema.ts` please, make this change below before testing the PR(to fix a bug, the slice is not updated yet):\ ### Demo ### Refs #6692 Fixes #6692 --------- Co-authored-by: gitstart-twenty Co-authored-by: Marie Stoppa --- .../currency/hooks/useCurrencySettingsFormInitialValues.ts | 6 ++---- .../src/pages/settings/data-model/SettingsObjects.tsx | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/hooks/useCurrencySettingsFormInitialValues.ts b/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/hooks/useCurrencySettingsFormInitialValues.ts index 26d9f492a599..d9ca44541b40 100644 --- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/hooks/useCurrencySettingsFormInitialValues.ts +++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/hooks/useCurrencySettingsFormInitialValues.ts @@ -12,11 +12,9 @@ export const useCurrencySettingsFormInitialValues = ({ }) => { const initialAmountMicrosValue = (fieldMetadataItem?.defaultValue?.amountMicros as number | null) ?? null; - const initialCurrencyCode = - (fieldMetadataItem?.defaultValue?.currencyCode as CurrencyCode) ?? - CurrencyCode.USD; const initialCurrencyCodeValue = - applySimpleQuotesToString(initialCurrencyCode); + fieldMetadataItem?.defaultValue?.currencyCode ?? + applySimpleQuotesToString(CurrencyCode.USD); const initialDefaultValue = { amountMicros: initialAmountMicrosValue, currencyCode: initialCurrencyCodeValue, diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjects.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjects.tsx index 30b148cdbd25..567364f892de 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjects.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjects.tsx @@ -128,6 +128,7 @@ export const SettingsObjects = () => { {SETTINGS_OBJECT_TABLE_METADATA.fields.map( (settingsObjectsTableMetadataField) => (