mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-18 09:02:11 +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) {
|
function handleSubmit(newText: string) {
|
||||||
if (newText === fieldValue) return;
|
if (newText === fieldValue) return;
|
||||||
|
|
||||||
if (!isURL(newText)) return;
|
if (newText !== '' && !isURL(newText)) return;
|
||||||
|
|
||||||
setFieldValue(newText);
|
setFieldValue(newText);
|
||||||
|
|
||||||
|
@ -85,7 +85,10 @@ export function PhoneCellEdit({
|
|||||||
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
function handleSubmit() {
|
function handleSubmit() {
|
||||||
if (isPossiblePhoneNumber(internalValue ?? '')) {
|
if (
|
||||||
|
internalValue === undefined ||
|
||||||
|
isPossiblePhoneNumber(internalValue ?? '')
|
||||||
|
) {
|
||||||
onSubmit(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 { isViewFieldDoubleTextChip } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextChip';
|
||||||
import { isViewFieldDoubleTextChipValue } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextChipValue';
|
import { isViewFieldDoubleTextChipValue } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextChipValue';
|
||||||
import { isViewFieldDoubleTextValue } from '@/ui/editable-field/types/guards/isViewFieldDoubleTextValue';
|
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 { isViewFieldMoney } from '@/ui/editable-field/types/guards/isViewFieldMoney';
|
||||||
import { isViewFieldMoneyValue } from '@/ui/editable-field/types/guards/isViewFieldMoneyValue';
|
import { isViewFieldMoneyValue } from '@/ui/editable-field/types/guards/isViewFieldMoneyValue';
|
||||||
import { isViewFieldNumber } from '@/ui/editable-field/types/guards/isViewFieldNumber';
|
import { isViewFieldNumber } from '@/ui/editable-field/types/guards/isViewFieldNumber';
|
||||||
@ -183,6 +185,19 @@ export function useUpdateEntityField() {
|
|||||||
) {
|
) {
|
||||||
const newContent = newFieldValueUnknown;
|
const newContent = newFieldValueUnknown;
|
||||||
|
|
||||||
|
updateEntity({
|
||||||
|
variables: {
|
||||||
|
where: { id: currentEntityId },
|
||||||
|
data: { [columnDefinition.metadata.fieldName]: newContent },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// Email
|
||||||
|
} else if (
|
||||||
|
isViewFieldEmail(columnDefinition) &&
|
||||||
|
isViewFieldEmailValue(newFieldValueUnknown)
|
||||||
|
) {
|
||||||
|
const newContent = newFieldValueUnknown;
|
||||||
|
|
||||||
updateEntity({
|
updateEntity({
|
||||||
variables: {
|
variables: {
|
||||||
where: { id: currentEntityId },
|
where: { id: currentEntityId },
|
||||||
|
Loading…
Reference in New Issue
Block a user