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):\ <https://github.com/twentyhq/twenty/commit/aa4ae53fb497d292f9b2319012482b942cbecfa5> ### Demo <https://www.loom.com/share/2ce130f2e2fe46868e9b1e9119f65cde?sid=dbcb2da2-3641-423c-bdfc-01b0fc52162a> ### Refs #6692 Fixes #6692 --------- Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: Marie Stoppa <marie.stoppa@essec.edu>
This commit is contained in:
co-authored by
gitstart-twenty
Marie Stoppa
parent
6467da5cab
commit
55685d3c5b
+2
-4
@@ -12,11 +12,9 @@ export const useCurrencySettingsFormInitialValues = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const initialAmountMicrosValue =
|
const initialAmountMicrosValue =
|
||||||
(fieldMetadataItem?.defaultValue?.amountMicros as number | null) ?? null;
|
(fieldMetadataItem?.defaultValue?.amountMicros as number | null) ?? null;
|
||||||
const initialCurrencyCode =
|
|
||||||
(fieldMetadataItem?.defaultValue?.currencyCode as CurrencyCode) ??
|
|
||||||
CurrencyCode.USD;
|
|
||||||
const initialCurrencyCodeValue =
|
const initialCurrencyCodeValue =
|
||||||
applySimpleQuotesToString(initialCurrencyCode);
|
fieldMetadataItem?.defaultValue?.currencyCode ??
|
||||||
|
applySimpleQuotesToString(CurrencyCode.USD);
|
||||||
const initialDefaultValue = {
|
const initialDefaultValue = {
|
||||||
amountMicros: initialAmountMicrosValue,
|
amountMicros: initialAmountMicrosValue,
|
||||||
currencyCode: initialCurrencyCodeValue,
|
currencyCode: initialCurrencyCodeValue,
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ export const SettingsObjects = () => {
|
|||||||
{SETTINGS_OBJECT_TABLE_METADATA.fields.map(
|
{SETTINGS_OBJECT_TABLE_METADATA.fields.map(
|
||||||
(settingsObjectsTableMetadataField) => (
|
(settingsObjectsTableMetadataField) => (
|
||||||
<SortableTableHeader
|
<SortableTableHeader
|
||||||
|
key={settingsObjectsTableMetadataField.fieldName}
|
||||||
fieldName={settingsObjectsTableMetadataField.fieldName}
|
fieldName={settingsObjectsTableMetadataField.fieldName}
|
||||||
label={settingsObjectsTableMetadataField.fieldLabel}
|
label={settingsObjectsTableMetadataField.fieldLabel}
|
||||||
tableId={SETTINGS_OBJECT_TABLE_METADATA.tableId}
|
tableId={SETTINGS_OBJECT_TABLE_METADATA.tableId}
|
||||||
|
|||||||
Reference in New Issue
Block a user