The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(studio): empty arrays become empty string in row editor (#16882)
Ryan Martinb3615444610d
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.tsindex 55e83c2a5d0..647ba32d1e8 100644--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts@@ -86,7 +86,6 @@ const parseValue = (originalValue: any, format: string) => {try {if (originalValue === null ||- (Array.isArray(originalValue) && originalValue.length === 0) ||(typeof originalValue === 'string' && originalValue.length === 0)) {return originalValuediff --git a/apps/studio/tests/components/Editor/RowEditor.utils.test.js b/apps/studio/tests/components/Editor/RowEditor.utils.test.jsindex 57e1958ef01..e74cbf507da 100644--- a/apps/studio/tests/components/Editor/RowEditor.utils.test.js+++ b/apps/studio/tests/components/Editor/RowEditor.utils.test.js@@ -10,19 +10,6 @@ describe('parseValue', () => {expect(parseValue(originalValue, format)).toBeNull()})- it('should return originalValue when it is an empty array', () => {- const originalValue = []- const format = 'some format'- expect(parseValue(originalValue, format)).toEqual(originalValue)- })-- it('should return originalValue when it is an empty object', () => {- const originalValue = {}- const format = 'some format'- const expectedValue = JSON.stringify(originalValue)- expect(parseValue(originalValue, format)).toEqual(expectedValue)- })-it('should return originalValue when it is 0', () => {const originalValue = 0const format = 'some format'@@ -41,6 +28,20 @@ describe('parseValue', () => {expect(parseValue(originalValue, format)).toEqual(originalValue)})+ it('should return JSON string representation when originalValue is an empty array', () => {+ const originalValue = []+ const format = 'some format'+ const expectedValue = JSON.stringify(originalValue)+ expect(parseValue(originalValue, format)).toEqual(expectedValue)+ })++ it('should return JSON string representation when originalValue is an empty object', () => {+ const originalValue = {}+ const format = 'some format'+ const expectedValue = JSON.stringify(originalValue)+ expect(parseValue(originalValue, format)).toEqual(expectedValue)+ })+it('should return JSON string representation when originalValue is an object', () => {const originalValue = { key: 'value' }const format = 'some format'