The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix wrong empty string formatting (#15949)
martmull6607fe05041b
diff --git a/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx b/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsxindex 25c5a27cf7e..9c554fdfc14 100644--- a/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx+++ b/packages/twenty-front/src/modules/ui/field/display/components/CurrencyDisplay.tsx@@ -23,8 +23,6 @@ export const CurrencyDisplay = ({}: CurrencyDisplayProps) => {const theme = useTheme();- const shouldDisplayCurrency = isDefined(currencyValue?.currencyCode);-const CurrencyIcon = isDefined(currencyValue?.currencyCode)? SETTINGS_FIELD_CURRENCY_CODES[currencyValue?.currencyCode]?.Icon: null;@@ -36,10 +34,6 @@ export const CurrencyDisplay = ({const format = fieldDefinition.metadata.settings?.format;const { formatNumber } = useNumberFormat();- if (!shouldDisplayCurrency) {- return <EllipsisDisplay>{0}</EllipsisDisplay>;- }-return (<EllipsisDisplay>{isDefined(CurrencyIcon) && amountToDisplay !== null && (diff --git a/packages/twenty-shared/src/utils/variable-resolver.test.ts b/packages/twenty-shared/src/utils/variable-resolver.test.tsindex d629cca6fea..377f1d1f724 100644--- a/packages/twenty-shared/src/utils/variable-resolver.test.ts+++ b/packages/twenty-shared/src/utils/variable-resolver.test.ts@@ -10,12 +10,31 @@ describe('resolveInput', () => {theme: 'dark',notifications: true,},+ specialValues: {+ nullValue: null,+ undefinedValue: undefined,+ emptyString: '',+ zero: 0,+ booleanFalse: false,+ booleanTrue: true,+ },};it('should return null for null input', () => {expect(resolveInput(null, context)).toBeNull();});+ it('should support special values', () => {+ expect(resolveInput('{{specialValues.nullValue}}', context)).toBeNull();+ expect(+ resolveInput('{{specialValues.undefinedValue}}', context),+ ).toBeUndefined();+ expect(resolveInput('{{specialValues.emptyString}}', context)).toBe('');+ expect(resolveInput('{{specialValues.zero}}', context)).toBe(0);+ expect(resolveInput('{{specialValues.booleanFalse}}', context)).toBe(false);+ expect(resolveInput('{{specialValues.booleanTrue}}', context)).toBe(true);+ });+it('should return undefined for undefined input', () => {expect(resolveInput(undefined, context)).toBeUndefined();});diff --git a/packages/twenty-shared/src/utils/variable-resolver.ts b/packages/twenty-shared/src/utils/variable-resolver.tsindex 6116da96354..92e5bcb2089 100644--- a/packages/twenty-shared/src/utils/variable-resolver.ts+++ b/packages/twenty-shared/src/utils/variable-resolver.ts@@ -99,7 +99,7 @@ const evalFromContext = (input: string, context: Record<string, unknown>) => {},});- return JSON.parse(inferredInput) ?? '';+ return JSON.parse(inferredInput);} catch {return undefined;}