The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: Parse the function args properly when editing a DB function (#22877)
Ivan Vasilov09c397f331f0
diff --git a/apps/studio/components/interfaces/Database/Functions/CreateFunction/CreateFunctionHeader.tsx b/apps/studio/components/interfaces/Database/Functions/CreateFunction/CreateFunctionHeader.tsxindex bf8eb775cfc..c3354a36930 100644--- a/apps/studio/components/interfaces/Database/Functions/CreateFunction/CreateFunctionHeader.tsx+++ b/apps/studio/components/interfaces/Database/Functions/CreateFunction/CreateFunctionHeader.tsx@@ -12,12 +12,7 @@ export const CreateFunctionHeader = ({setAssistantVisible: (v: boolean) => void}) => {return (- <SheetHeader- className={cn(- selectedFunction !== undefined ? 'pt-3 pb-0' : 'py-3',- 'flex flex-row justify-between items-center border-b-0'- )}- >+ <SheetHeader className="py-3 flex flex-row justify-between items-center border-b-0"><div className="flex flex-row gap-3 items-center max-w-[75%]"><SheetCloseclassName={cn(diff --git a/apps/studio/components/interfaces/Database/Functions/Functions.utils.ts b/apps/studio/components/interfaces/Database/Functions/Functions.utils.tsindex ea8298366ba..4735085221e 100644--- a/apps/studio/components/interfaces/Database/Functions/Functions.utils.ts+++ b/apps/studio/components/interfaces/Database/Functions/Functions.utils.ts@@ -7,13 +7,19 @@ import { isEmpty } from 'lodash'export function convertArgumentTypes(value: string) {const items = value?.split(',')if (isEmpty(value) || !items || items?.length == 0) return { value: [] }- const temp = items.map((x) => {- const str = x.trim()- const space = str.indexOf(' ')- const name = str.slice(0, space !== 1 ? space : 0)- const type = str.slice(space + 1)- return { name, type }- })+ const temp = items+ .map((x) => {+ const str = x.trim()+ const splitted = str.split(' ')+ if (splitted.length === 2) {+ return { name: splitted[0], type: splitted[1] }+ }+ if (splitted.length === 1) {+ return { name: splitted[0], type: splitted[0] }+ }+ console.error('Error while trying to parse function arguments', value)+ })+ .filter(Boolean) as { name: string; type: string }[]return { value: temp }}