fix: zero showing in record cell and page (#7384)
This PR fixes zero being displayed as empty in record cell and show page in currency field #6802 I checked graphql resquests and the data is stored in the correct form (0 or null). The problem only lies in the front end and how the field is null checked. --------- Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
@ -29,7 +29,10 @@ export const CurrencyDisplay = ({ currencyValue }: CurrencyDisplayProps) => {
|
||||
? SETTINGS_FIELD_CURRENCY_CODES[currencyValue?.currencyCode]?.Icon
|
||||
: null;
|
||||
|
||||
const amountToDisplay = (currencyValue?.amountMicros ?? 0) / 1000000;
|
||||
const amountToDisplay =
|
||||
currencyValue?.amountMicros != null
|
||||
? currencyValue?.amountMicros / 1000000
|
||||
: null;
|
||||
|
||||
if (!shouldDisplayCurrency) {
|
||||
return <StyledEllipsisDisplay>{0}</StyledEllipsisDisplay>;
|
||||
@ -46,7 +49,7 @@ export const CurrencyDisplay = ({ currencyValue }: CurrencyDisplayProps) => {
|
||||
/>{' '}
|
||||
</>
|
||||
)}
|
||||
{amountToDisplay !== 0 ? formatAmount(amountToDisplay) : ''}
|
||||
{amountToDisplay !== null ? formatAmount(amountToDisplay) : ''}
|
||||
</StyledEllipsisDisplay>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user