From 97d44d13baaf3976a1d0e687207ad24ae11337c4 Mon Sep 17 00:00:00 2001 From: Paul Rastoin <45004772+prastoin@users.noreply.github.com> Date: Fri, 9 May 2025 10:57:59 +0200 Subject: [PATCH] Fix field currency form settings (#11948) # Introduction Close #11947 From my understanding this `singleQuote` manipulation is legacy due to front preparing sql queries in some way. We might wanna standardize this behavior for each `CURRENCIES` usage, such as within the `ObjectFilterDropdownCurrencySelect` that does not send nor expect singled quoted encapsulated currencies values. Created core-team-issues tech issue https://github.com/twentyhq/core-team-issues/issues/941 ## Field creation variables ```json { "input": { "field": { "defaultValue": { "amountMicros": null, "currencyCode": "'BYN'" }, "description": "", "icon": "IconMoneybag", "label": "Maquito", "name": "maquito", "isLabelSyncedWithName": true, "objectMetadataId": "6ef5da20-cf03-49b5-81fe-73aa2c9856a9", "type": "CURRENCY" } } } ``` ## Filtering variables ```json { "filter": { "test": { "currencyCode": { "in": [ "ALL", "AED", "AFN", "ANG" ] } } }, "orderBy": [ { "position": "AscNullsFirst" } ] } ``` --- .../components/SettingsDataModelFieldCurrencyForm.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/components/SettingsDataModelFieldCurrencyForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/components/SettingsDataModelFieldCurrencyForm.tsx index 65920c933..cab05076a 100644 --- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/components/SettingsDataModelFieldCurrencyForm.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/components/SettingsDataModelFieldCurrencyForm.tsx @@ -9,6 +9,7 @@ import { useCurrencySettingsFormInitialValues } from '@/settings/data-model/fiel import { Select } from '@/ui/input/components/Select'; import { useLingui } from '@lingui/react/macro'; import { IconCurrencyDollar } from 'twenty-ui/display'; +import { applySimpleQuotesToString } from '~/utils/string/applySimpleQuotesToString'; export const settingsDataModelFieldCurrencyFormSchema = z.object({ defaultValue: currencyFieldDefaultValueSchema, @@ -58,7 +59,10 @@ export const SettingsDataModelFieldCurrencyForm = ({ onChange={onChange} disabled={disabled} dropdownId="object-field-default-value-select-currency" - options={CURRENCIES} + options={CURRENCIES.map(({ value, ...rest }) => ({ + ...rest, + value: applySimpleQuotesToString(value), + }))} selectSizeVariant="small" withSearchInput={true} />