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" } ] } ```
This commit is contained in:
@ -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}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user