Skip to content

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

Use the sql/[id] page for new and existing snippets.

Ivan Vasilov0913089839f8
diff --git a/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/studio/components/interfaces/SQLEditor/SQLEditor.tsx
index 92e9a53a582..281cf0791f4 100644
--- a/studio/components/interfaces/SQLEditor/SQLEditor.tsx
+++ b/studio/components/interfaces/SQLEditor/SQLEditor.tsx
@@ -82,9 +82,12 @@ export function useSqlEditor() {
const SQLEditor = () => {
const { ui } = useStore()
- const { ref, id } = useParams()
+ const { ref, id: urlId } = useParams()
const router = useRouter()
const telemetryProps = useTelemetryProps()
+
+ const [id] = useState(urlId === 'new' ? uuidv4() : urlId)
+
const { profile } = useProfile()
const project = useSelectedProject()
const snap = useSqlEditorStateSnapshot()
diff --git a/studio/pages/project/[ref]/sql/index.tsx b/studio/pages/project/[ref]/sql/index.tsx
deleted file mode 100644
index 456822164fc..00000000000
--- a/studio/pages/project/[ref]/sql/index.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import SQLAI from 'components/interfaces/SQLEditor/SQLTemplates/SQLAI'
-import { SQLEditorLayout } from 'components/layouts'
-import { observer } from 'mobx-react-lite'
-import { NextPageWithLayout } from 'types'
-
-const SqlEditorWelcome: NextPageWithLayout = () => {
- return <SQLAI />
-}
-
-SqlEditorWelcome.getLayout = (page) => (
- <SQLEditorLayout title="Build with AI">{page}</SQLEditorLayout>
-)
-
-export default observer(SqlEditorWelcome)