mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-18 17:12:53 +03:00
Fix column not being saved properly (#1429)
* Fix email column not being saved * Fix URL fields not being clearable * Fix phone number clearing
This commit is contained in:
parent
3a0f02f2f2
commit
1a71f61d24
@ -30,7 +30,7 @@ export function GenericEditableURLCellEditMode({ columnDefinition }: OwnProps) {
|
||||
function handleSubmit(newText: string) {
|
||||
if (newText === fieldValue) return;
|
||||
|
||||
if (!isURL(newText)) return;
|
||||
if (newText !== '' && !isURL(newText)) return;
|
||||
|
||||
setFieldValue(newText);
|
||||
|
||||
|
@ -85,7 +85,10 @@ export function PhoneCellEdit({
|
||||
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
function handleSubmit() {
|
||||
if (isPossiblePhoneNumber(internalValue ?? '')) {
|
||||
if (
|
||||
internalValue === undefined ||
|
||||
isPossiblePhoneNumber(internalValue ?? '')
|
||||
) {
|
||||
onSubmit(internalValue ?? '');
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ import { isViewFieldDoubleText } from '@/ui/editable-field/types/guards/isViewFi
|
||||
import { isViewFieldDoubleTextChip } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextChip';
|
||||
import { isViewFieldDoubleTextChipValue } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextChipValue';
|
||||
import { isViewFieldDoubleTextValue } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextValue';
|
||||
import { isViewFieldEmail } from '@/ui/editable-field/types/guards/isViewFieldEmail';
|
||||
import { isViewFieldEmailValue } from '@/ui/editable-field/types/guards/isViewFieldEmailValue';
|
||||
import { isViewFieldMoney } from '@/ui/editable-field/types/guards/isViewFieldMoney';
|
||||
import { isViewFieldMoneyValue } from '@/ui/editable-field/types/guards/isViewFieldMoneyValue';
|
||||
import { isViewFieldNumber } from '@/ui/editable-field/types/guards/isViewFieldNumber';
|
||||
@ -183,6 +185,19 @@ export function useUpdateEntityField() {
|
||||
) {
|
||||
const newContent = newFieldValueUnknown;
|
||||
|
||||
updateEntity({
|
||||
variables: {
|
||||
where: { id: currentEntityId },
|
||||
data: { [columnDefinition.metadata.fieldName]: newContent },
|
||||
},
|
||||
});
|
||||
// Email
|
||||
} else if (
|
||||
isViewFieldEmail(columnDefinition) &&
|
||||
isViewFieldEmailValue(newFieldValueUnknown)
|
||||
) {
|
||||
const newContent = newFieldValueUnknown;
|
||||
|
||||
updateEntity({
|
||||
variables: {
|
||||
where: { id: currentEntityId },
|
||||
|
Loading…
Reference in New Issue
Block a user