Skip to content

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

Fix missing app frameworks in connect modal (#38712)

Joshen Lim84e3f5041e60
diff --git a/apps/studio/components/interfaces/Connect/Connect.tsx b/apps/studio/components/interfaces/Connect/Connect.tsx
index 6ebdba355ef..7a816671e11 100644
--- a/apps/studio/components/interfaces/Connect/Connect.tsx
+++ b/apps/studio/components/interfaces/Connect/Connect.tsx
@@ -34,7 +34,6 @@ import { CONNECTION_TYPES, ConnectionType, FRAMEWORKS, MOBILES, ORMS } from './C
import { getContentFilePath } from './Connect.utils'
import { ConnectDropdown } from './ConnectDropdown'
import { ConnectTabContent } from './ConnectTabContent'
-import { ConnectTabContentCustom } from './ConnectTabContentCustom'
export const Connect = () => {
const { ref: projectRef } = useParams()
@@ -70,10 +69,10 @@ export const Connect = () => {
)
// helper to get the connection type object
- function getConnectionObjectForTab(tab: string | null, frameworks: ConnectionType[]) {
+ function getConnectionObjectForTab(tab: string | null) {
switch (tab) {
case 'frameworks':
- return frameworks
+ return FRAMEWORKS
case 'mobiles':
return MOBILES
case 'orms':
@@ -99,8 +98,6 @@ export const Connect = () => {
?.children.find((child) => child.key === selectedChild)?.children[0]?.key || ''
)
- const isFrameworkSelected = FRAMEWORKS.some((x) => x.key === selectedParent)
-
const { data: settings } = useProjectSettingsV2Query({ projectRef }, { enabled: showConnect })
const { can: canReadAPIKeys } = useAsyncCheckProjectPermissions(
PermissionAction.READ,
@@ -259,7 +256,7 @@ export const Connect = () => {
useEffect(() => {
if (!showConnect) return
- const newConnectionObject = getConnectionObjectForTab(tab, FRAMEWORKS)
+ const newConnectionObject = getConnectionObjectForTab(tab)
setConnectionObject(newConnectionObject)
const parent =
@@ -413,18 +410,11 @@ export const Connect = () => {
<p className="text-xs text-foreground-lighter my-3">
Add the following files below to your application
</p>
- {isFrameworkSelected ? (
- <ConnectTabContentCustom
- projectKeys={projectKeys}
- framework={FRAMEWORKS.find((x) => x.key === selectedParent)}
- />
- ) : (
- <ConnectTabContent
- projectKeys={projectKeys}
- filePath={filePath}
- className="rounded-b-none"
- />
- )}
+ <ConnectTabContent
+ projectKeys={projectKeys}
+ filePath={filePath}
+ className="rounded-b-none"
+ />
<Panel.Notice
className="border border-t-0 rounded-lg rounded-t-none"
title="New API keys coming 2025"
diff --git a/apps/studio/components/interfaces/Connect/ConnectTabContentCustom.tsx b/apps/studio/components/interfaces/Connect/ConnectTabContentCustom.tsx
deleted file mode 100644
index c56c8e194d0..00000000000
--- a/apps/studio/components/interfaces/Connect/ConnectTabContentCustom.tsx
+++ /dev/null
@@ -1,56 +0,0 @@
-import { useEffect, useState } from 'react'
-
-import { cn, SimpleCodeBlock } from 'ui'
-import { ConnectionType } from './Connect.constants'
-import { projectKeys } from './Connect.types'
-import {
- ConnectTabContent,
- ConnectTabs,
- ConnectTabTrigger,
- ConnectTabTriggers,
-} from './ConnectTabs'
-
-interface ConnectTabContentCustomProps {
- projectKeys: projectKeys
- framework?: ConnectionType
-}
-
-export const ConnectTabContentCustom = ({
- projectKeys,
- framework,
-}: ConnectTabContentCustomProps) => {
- const { files = [] } = framework ?? {}
-
- const [selectedTab, setSelectedTab] = useState<string>()
-
- useEffect(() => {
- if (framework?.files) setSelectedTab(framework.files[0].name)
- }, [framework])
-
- return (
- <div className={cn('border rounded-lg rounded-b-none')}>
- <ConnectTabs value={selectedTab} onValueChange={setSelectedTab}>
- <ConnectTabTriggers>
- {files.map((x) => (
- <ConnectTabTrigger key={`${x.name}-tab`} value={x.name} />
- ))}
- </ConnectTabTriggers>
-
- {files.map((x) => {
- const format = x.name.split('.')[1] ?? 'bash'
- const content = x.content
- .replaceAll('{{apiUrl}}', projectKeys.apiUrl ?? '')
- .replaceAll('{{anonKey}}', projectKeys.anonKey ?? '')
- .replaceAll('{{publishableKey}}', projectKeys.publishableKey ?? '')
- return (
- <ConnectTabContent key={`${x.name}-content`} value={x.name}>
- <SimpleCodeBlock className={format} parentClassName="min-h-72">
- {content}
- </SimpleCodeBlock>
- </ConnectTabContent>
- )
- })}
- </ConnectTabs>
- </div>
- )
-}