Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix table editor editing a row, setting a timestamptz column to NULL doesn't work (#45824)

Joshen Lim602b879e4aa2
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/DateTimeInput/index.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/DateTimeInput/index.tsx
index f7e280f896e..84032262ea4 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/DateTimeInput/index.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/DateTimeInput/index.tsx
@@ -19,7 +19,7 @@ interface DateTimeInputProps {
value: string
isNullable: boolean
description: string | ReactNode
- onChange: (value: string) => void
+ onChange: (value: string | null) => void
disabled?: boolean
}
@@ -65,7 +65,7 @@ export const DateTimeInput = ({
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-28 pointer-events-auto">
{isNullable && (
- <DropdownMenuItem onClick={() => onChange('')}>Set to NULL</DropdownMenuItem>
+ <DropdownMenuItem onClick={() => onChange(null)}>Set to NULL</DropdownMenuItem>
)}
<DropdownMenuItem
onClick={() =>
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/InputField.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/InputField.tsx
index c1c0289d9be..300f170d6ed 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/InputField.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/InputField.tsx
@@ -276,7 +276,7 @@ export const InputField = ({
{field.comment && <p>{field.comment}</p>}
</>
}
- onChange={(value: any) => onUpdateField({ [field.name]: value })}
+ onChange={(value: string | null) => onUpdateField({ [field.name]: value })}
disabled={!isEditable}
/>
)