Skip to content

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

Dont stringify nil values for JSON editor

Nick Rayburn9cf3935d7a61
diff --git a/studio/components/grid/components/editor/JsonEditor.tsx b/studio/components/grid/components/editor/JsonEditor.tsx
index 93ea44dbc9a..bcafd2444da 100644
--- a/studio/components/grid/components/editor/JsonEditor.tsx
+++ b/studio/components/grid/components/editor/JsonEditor.tsx
@@ -6,6 +6,7 @@ import { EditorProps } from '@supabase/react-data-grid'
import { useTrackedState } from 'components/grid/store'
import { BlockKeys, MonacoEditor, NullValue } from 'components/grid/components/common'
import { tryParseJson } from 'lib/helpers'
+import { isNil } from "lodash";
interface JsonEditorProps<TRow, TSummaryRow = unknown> extends EditorProps<TRow, TSummaryRow> {
onExpandEditor: (column: string, row: TRow) => void
@@ -21,7 +22,7 @@ export function JsonEditor<TRow, TSummaryRow = unknown>({
const gridColumn = state.gridColumns.find((x) => x.name == column.key)
const initialValue = row[column.key as keyof TRow] as unknown
- const jsonString = prettifyJSON(initialValue ? JSON.stringify(initialValue) : '')
+ const jsonString = prettifyJSON(!isNil(initialValue) ? JSON.stringify(initialValue) : '')
const [isPopoverOpen, setIsPopoverOpen] = useState(true)
const [value, setValue] = useState<string | null>(jsonString)