Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send null for string like columns that don't allow empty strings when cell is cleared #4030

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion mathesar_ui/src/stores/table-data/records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,16 @@
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",

Check failure on line 596 in mathesar_ui/src/stores/table-data/records.ts

View workflow job for this annotation

GitHub Actions / Run front end linter

Strings must use singlequote
"date",

Check failure on line 597 in mathesar_ui/src/stores/table-data/records.ts

View workflow job for this annotation

GitHub Actions / Run front end linter

Strings must use singlequote
"timestamp with time zone",

Check failure on line 598 in mathesar_ui/src/stores/table-data/records.ts

View workflow job for this annotation

GitHub Actions / Run front end linter

Strings must use singlequote
"mathesar_types.uri",

Check failure on line 599 in mathesar_ui/src/stores/table-data/records.ts

View workflow job for this annotation

GitHub Actions / Run front end linter

Strings must use singlequote
"time with time zone",

Check failure on line 600 in mathesar_ui/src/stores/table-data/records.ts

View workflow job for this annotation

GitHub Actions / Run front end linter

Strings must use singlequote
]);
if (nullableColumnTypes.has(column.type) && record[column.id] === "") {

Check failure on line 602 in mathesar_ui/src/stores/table-data/records.ts

View workflow job for this annotation

GitHub Actions / Run front end linter

Strings must use singlequote
record[column.id] = null;
}
const promise = api.records
.patch({
...this.apiContext,
Expand Down
Loading