Skip to content

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

Prevent setting value to NULL when hitting Enter while highlighting cell in table editor thats of text type and nullable

Joshen Lim9b9e6d7a432d
diff --git a/studio/components/grid/components/editor/TextEditor.tsx b/studio/components/grid/components/editor/TextEditor.tsx
index 09b98506491..e65ad5db455 100644
--- a/studio/components/grid/components/editor/TextEditor.tsx
+++ b/studio/components/grid/components/editor/TextEditor.tsx
@@ -22,6 +22,7 @@ export function TextEditor<TRow, TSummaryRow = unknown>({
}, [])
const saveChanges = useCallback((newValue: string | null) => {
+ console.log('saveChanges')
onRowChange({ ...row, [column.key]: newValue }, true)
setIsPopoverOpen(false)
}, [])
@@ -62,7 +63,13 @@ export function TextEditor<TRow, TSummaryRow = unknown>({
</div>
<div className="space-y-1">
{isNullable && (
- <Button type="default" size="tiny" onClick={() => saveChanges(null)}>
+ <Button
+ as="div"
+ htmlType="button"
+ type="default"
+ size="tiny"
+ onClick={(event) => saveChanges(null)}
+ >
Set to NULL
</Button>
)}