From 3a995329260f5e28de345f5f9020deb2c548580e Mon Sep 17 00:00:00 2001 From: aniket Date: Tue, 19 Nov 2024 16:35:22 +0000 Subject: [PATCH] Send null for string like columns that don't allow empty strings when cell is cleared --- mathesar_ui/src/stores/table-data/records.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mathesar_ui/src/stores/table-data/records.ts b/mathesar_ui/src/stores/table-data/records.ts index 5a41f33d2b..35178850c9 100644 --- a/mathesar_ui/src/stores/table-data/records.ts +++ b/mathesar_ui/src/stores/table-data/records.ts @@ -592,7 +592,16 @@ export class RecordsData { const cellKey = getCellKey(rowKey, column.id); this.meta.cellModificationStatus.set(cellKey, { state: 'processing' }); this.updatePromises?.get(cellKey)?.cancel(); - + const nullableColumnTypes = new Set([ + "mathesar_types.email", + "date", + "timestamp with time zone", + "mathesar_types.uri", + "time with time zone", + ]); + if (nullableColumnTypes.has(column.type) && record[column.id] === "") { + record[column.id] = null; + } const promise = api.records .patch({ ...this.apiContext,