The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: content param doesn't work in the SQL editor (#18176)
Ivan Vasilovcde1731b43b2
diff --git a/studio/components/interfaces/SQLEditor/MonacoEditor.tsx b/studio/components/interfaces/SQLEditor/MonacoEditor.tsxindex 00ecad1f5fc..c56df7f2e45 100644--- a/studio/components/interfaces/SQLEditor/MonacoEditor.tsx+++ b/studio/components/interfaces/SQLEditor/MonacoEditor.tsx@@ -1,9 +1,9 @@import Editor, { Monaco, OnMount } from '@monaco-editor/react'import { useParams } from 'common'+import { debounce } from 'lodash'import { useRouter } from 'next/router'-import { MutableRefObject, useRef } from 'react'+import { MutableRefObject, useEffect, useRef } from 'react'import { cn } from 'ui'-import { debounce, memoize } from 'lodash'import { SqlSnippet } from 'data/content/sql-snippets-query'import { useSelectedProject } from 'hooks'@@ -100,6 +100,14 @@ const MonacoEditor = ({}}+ // if an SQL query is passed by the content parameter, set the editor value to its content. This+ // is usually used for sending the user to SQL editor from other pages with SQL.+ useEffect(() => {+ if (content && content.length > 0) {+ handleEditorChange(content)+ }+ }, [])+return (<EditorclassName={cn(className, 'monaco-editor')}@@ -107,7 +115,7 @@ const MonacoEditor = ({onMount={handleEditorOnMount}onChange={handleEditorChange}defaultLanguage="pgsql"- defaultValue={snippet?.snippet.content.sql ?? content}+ defaultValue={snippet?.snippet.content.sql}path={id}options={{tabSize: 2,