Skip to content

Commit

Permalink
Fix currency field edition form (#6723)
Browse files Browse the repository at this point in the history
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](#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):\

<aa4ae53>

### Demo


<https://www.loom.com/share/2ce130f2e2fe46868e9b1e9119f65cde?sid=dbcb2da2-3641-423c-bdfc-01b0fc52162a>

### Refs

#6692

Fixes #6692

---------

Co-authored-by: gitstart-twenty <[email protected]>
Co-authored-by: Marie Stoppa <[email protected]>
  • Loading branch information
3 people authored Aug 26, 2024
1 parent 6467da5 commit 55685d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const SettingsObjects = () => {
{SETTINGS_OBJECT_TABLE_METADATA.fields.map(
(settingsObjectsTableMetadataField) => (
<SortableTableHeader
key={settingsObjectsTableMetadataField.fieldName}
fieldName={settingsObjectsTableMetadataField.fieldName}
label={settingsObjectsTableMetadataField.fieldLabel}
tableId={SETTINGS_OBJECT_TABLE_METADATA.tableId}
Expand Down

0 comments on commit 55685d3

Please sign in to comment.