Skip to content

Commit 93f4e74

Browse files
committed
update
1 parent cea04b0 commit 93f4e74

File tree

1 file changed

+7
-3
lines changed
  • packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components

1 file changed

+7
-3
lines changed

packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/CurrencyFieldInput.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { RecordFieldComponentInstanceContext } from '@/object-record/record-fiel
1212
import { isFieldCurrencyValue } from '@/object-record/record-field/ui/types/guards/isFieldCurrencyValue';
1313
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
1414
import { useContext } from 'react';
15+
import { isDefined } from 'twenty-shared/utils';
1516
import { convertCurrencyAmountToCurrencyMicros } from '~/utils/convertCurrencyToCurrencyMicros';
1617
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
1718

@@ -26,9 +27,12 @@ export const CurrencyFieldInput = () => {
2627
RecordFieldComponentInstanceContext,
2728
);
2829

29-
const defaultCurrencyCodeWithoutSQLQuotes = (
30-
defaultValue as FieldCurrencyValue
31-
)?.currencyCode.replace(/'/g, '') as CurrencyCode;
30+
const defaultCurrencyCodeWithoutSQLQuotes = isDefined(defaultValue)
31+
? ((defaultValue as FieldCurrencyValue).currencyCode.replace(
32+
/'/g,
33+
'',
34+
) as CurrencyCode)
35+
: undefined;
3236

3337
const defaultCurrencyCodeIsNotEmpty = isNonEmptyString(
3438
defaultCurrencyCodeWithoutSQLQuotes,

0 commit comments

Comments
 (0)