Skip to content

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

fix nullable field value in RowEditor utils

Alaister Youngd616375e9920
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts
index e6863a4269e..942be27d3d3 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts
@@ -60,16 +60,16 @@ export const generateRowFields = (
export const validateFields = (fields: RowField[]) => {
const errors = {} as any
fields.forEach((field) => {
- if (field.format.startsWith('_') && field.value?.length > 0) {
+ if (field.format.startsWith('_') && (field.value?.length ?? 0) > 0) {
try {
- minifyJSON(field.value)
+ minifyJSON(field.value ?? '')
} catch {
errors[field.name] = 'Invalid array'
}
}
- if (field.format.includes('json') && field.value?.length > 0) {
+ if (field.format.includes('json') && (field.value?.length ?? 0) > 0) {
try {
- minifyJSON(field.value)
+ minifyJSON(field.value ?? '')
} catch {
errors[field.name] = 'Invalid JSON'
}