mirror of
https://github.com/twentyhq/twenty.git
synced 2025-01-04 18:21:59 +03:00
fix: can't set ARR of company to empty (#1474)
This commit is contained in:
parent
91e146ed3e
commit
08b56ec7e2
@ -130,7 +130,7 @@ export type ViewFieldDateValue = string;
|
||||
export type ViewFieldPhoneValue = string;
|
||||
export type ViewFieldEmailValue = string;
|
||||
export type ViewFieldBooleanValue = boolean;
|
||||
export type ViewFieldMoneyValue = number;
|
||||
export type ViewFieldMoneyValue = number | null;
|
||||
export type ViewFieldURLValue = string;
|
||||
export type ViewFieldNumberValue = number | null;
|
||||
export type ViewFieldProbabilityValue = number;
|
||||
|
@ -3,5 +3,8 @@ import { ViewFieldMoneyValue } from '../ViewField';
|
||||
export function isViewFieldMoneyValue(
|
||||
fieldValue: unknown,
|
||||
): fieldValue is ViewFieldMoneyValue {
|
||||
return typeof fieldValue === 'number';
|
||||
return (
|
||||
fieldValue === null ||
|
||||
(fieldValue !== undefined && typeof fieldValue === 'number')
|
||||
);
|
||||
}
|
||||
|
@ -31,17 +31,17 @@ export function GenericEditableMoneyCellEditMode({
|
||||
if (newText === fieldValue) return;
|
||||
|
||||
try {
|
||||
const numberValue = parseInt(newText);
|
||||
const numberValue = newText !== '' ? parseInt(newText) : null;
|
||||
|
||||
if (isNaN(numberValue)) {
|
||||
if (numberValue && isNaN(numberValue)) {
|
||||
throw new Error('Not a number');
|
||||
}
|
||||
|
||||
if (numberValue > 2000000000) {
|
||||
if (numberValue && numberValue > 2000000000) {
|
||||
throw new Error('Number too big');
|
||||
}
|
||||
|
||||
setFieldValue(numberValue.toString());
|
||||
setFieldValue(numberValue ? numberValue.toString() : '');
|
||||
|
||||
if (currentRowEntityId && updateField) {
|
||||
updateField(currentRowEntityId, columnDefinition, numberValue);
|
||||
|
Loading…
Reference in New Issue
Block a user