Skip to content

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

chore: better github installation flow (#18066)

Alaister Youngdec916bbb122
diff --git a/studio/components/interfaces/Integrations/IntegrationPanels.tsx b/studio/components/interfaces/Integrations/IntegrationPanels.tsx
index 18a052af1ba..72986ac0839 100644
--- a/studio/components/interfaces/Integrations/IntegrationPanels.tsx
+++ b/studio/components/interfaces/Integrations/IntegrationPanels.tsx
@@ -185,7 +185,7 @@ const IntegrationConnection = React.forwardRef<HTMLLIElement, IntegrationConnect
alt={`icon`}
/>
)}
- <span className="text-sm">{connection.metadata?.name}</span>
+ <span className="text-sm truncate">{connection.metadata?.name}</span>
</div>
<div className="flex flex-col gap-0">
@@ -241,8 +241,12 @@ const IntegrationConnectionOption = React.forwardRef<HTMLLIElement, IntegrationC
const EmptyIntegrationConnection = React.forwardRef<
HTMLDivElement,
- React.HTMLAttributes<HTMLDivElement> & { showNode?: boolean }
->(({ className, showNode = true, ...props }, ref) => {
+ React.HTMLAttributes<HTMLDivElement> & {
+ showNode?: boolean
+ orgSlug?: string
+ onClick: () => void
+ }
+>(({ className, showNode = true, orgSlug = '_', onClick, ...props }, ref) => {
return (
<div
ref={ref}
@@ -266,7 +270,9 @@ const EmptyIntegrationConnection = React.forwardRef<
'flex h-20 px-10 rounded-lg justify-center items-center'
)}
>
- <Button type="default">Add new project connection</Button>
+ <Button type="default" onClick={() => onClick()}>
+ Add new project connection
+ </Button>
</div>
</div>
)
diff --git a/studio/components/interfaces/Integrations/ProjectLinker.tsx b/studio/components/interfaces/Integrations/ProjectLinker.tsx
index 059f15bc99d..9953075a84d 100644
--- a/studio/components/interfaces/Integrations/ProjectLinker.tsx
+++ b/studio/components/interfaces/Integrations/ProjectLinker.tsx
@@ -1,4 +1,4 @@
-import { ReactNode, useRef, useState } from 'react'
+import { ReactNode, useEffect, useRef, useState } from 'react'
import { toast } from 'react-hot-toast'
import {
Button,
@@ -79,9 +79,18 @@ const ProjectLinker = ({
const [supabaseProjectRef, setSupabaseProjectRef] = useState<string | undefined>(
defaultSupabaseProjectRef
)
+ useEffect(() => {
+ if (defaultSupabaseProjectRef !== undefined && supabaseProjectRef === undefined)
+ setSupabaseProjectRef(defaultSupabaseProjectRef)
+ }, [defaultSupabaseProjectRef, supabaseProjectRef])
+
const [foreignProjectId, setForeignProjectId] = useState<string | undefined>(
defaultForeignProjectId
)
+ useEffect(() => {
+ if (defaultForeignProjectId !== undefined && foreignProjectId === undefined)
+ setForeignProjectId(defaultForeignProjectId)
+ }, [defaultForeignProjectId, foreignProjectId])
// create a flat array of foreign project ids. ie, ["prj_MlkO6AiLG5ofS9ojKrkS3PhhlY3f", ..]
const flatInstalledConnectionsIds = new Set(installedConnections.map((x) => x.foreign_project_id))
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
index 4657846b2a5..bfff1701a55 100644
--- a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
+++ b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
@@ -215,7 +215,10 @@ You can change the scope of the access for Supabase by configuring
)} Repository connections for Vercel`}
/>
)}
- <EmptyIntegrationConnection onClick={() => onAddVercelConnection(integration.id)}>
+ <EmptyIntegrationConnection
+ onClick={() => onAddVercelConnection(integration.id)}
+ orgSlug={org?.slug}
+ >
Add new project connection
</EmptyIntegrationConnection>
</div>
@@ -303,7 +306,10 @@ These connections will be part of a GitHub workflow that is currently in develop
)} Repository connections for GitHub`}
/>
)}
- <EmptyIntegrationConnection onClick={() => onAddGitHubConnection(integration.id)}>
+ <EmptyIntegrationConnection
+ onClick={() => onAddGitHubConnection(integration.id)}
+ orgSlug={org?.slug}
+ >
Add new project connection
</EmptyIntegrationConnection>
</div>
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker.tsx b/studio/components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker.tsx
index 6b2947b3dcb..2c1da9cf54d 100644
--- a/studio/components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker.tsx
+++ b/studio/components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker.tsx
@@ -54,7 +54,7 @@ const SidePanelGitHubRepoLinker = ({ projectRef }: SidePanelGitHubRepoLinkerProp
/**
* Supabase projects available
*/
- const { data: supabaseProjectsData } = useProjectsQuery({
+ const { data: supabaseProjectsData, isLoading: isLoadingSupabaseProjects } = useProjectsQuery({
enabled: organizationIntegrationId !== undefined,
})
@@ -67,7 +67,7 @@ const SidePanelGitHubRepoLinker = ({ projectRef }: SidePanelGitHubRepoLinkerProp
[selectedOrganization?.id, supabaseProjectsData]
)
- const { data: githubProjectsData } = useGitHubReposQuery(
+ const { data: githubProjectsData, isLoading: isLoadingGitHubRepos } = useGitHubReposQuery(
{
integrationId: organizationIntegrationId,
},
@@ -136,6 +136,8 @@ Check the details below before proceeding
onCreateConnections={createGithubConnection}
installedConnections={selectedIntegration?.connections}
isLoading={isCreatingConnection}
+ loadingForeignProjects={isLoadingGitHubRepos}
+ loadingSupabaseProjects={isLoadingSupabaseProjects}
integrationIcon={GITHUB_ICON}
choosePrompt="Choose GitHub Repo"
/>
diff --git a/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx b/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx
index 7dee26e4b73..c1203dd2809 100644
--- a/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx
+++ b/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx
@@ -1,5 +1,6 @@
import { useCallback } from 'react'
+import { useParams } from 'common'
import { IntegrationConnectionItem } from 'components/interfaces/Integrations/IntegrationConnection'
import {
IntegrationConnectionHeader,
@@ -40,6 +41,7 @@ const GitHubSection = () => {
const { ui } = useStore()
const org = useSelectedOrganization()
const { data } = useOrgIntegrationsQuery({ orgSlug: org?.slug })
+ const { ref: projectRef } = useParams()
const githubIntegrations = data?.filter(
(integration) => integration.integration.name === 'GitHub'
@@ -84,17 +86,21 @@ const GitHubSection = () => {
'connection'
)} `
+ const connections = integration.connections.filter((connection) =>
+ projectRef ? connection.supabase_project_ref === projectRef : true
+ )
+
return (
<div key={integration.id}>
<IntegrationInstallation title={'GitHub'} integration={integration} />
- {integration.connections.length > 0 ? (
+ {connections.length > 0 ? (
<>
<IntegrationConnectionHeader
// title={ConnectionHeaderTitle}
// markdown={`Repository connections for GitHub`}
/>
<ul className="flex flex-col">
- {integration.connections.map((connection) => (
+ {connections.map((connection) => (
<div
key={connection.id}
className="relative flex flex-col -gap-[1px] [&>li]:pb-0"
@@ -120,8 +126,8 @@ const GitHubSection = () => {
</>
) : (
<IntegrationConnectionHeader
- markdown={`### ${integration.connections.length} project ${pluralize(
- integration.connections.length,
+ markdown={`### ${connections.length} project ${pluralize(
+ connections.length,
'connection'
)} Repository connections for GitHub`}
/>
diff --git a/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsx b/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsx
index 1935ee7270f..e34ea6c543d 100644
--- a/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsx
+++ b/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsx
@@ -171,6 +171,7 @@ You can change the scope of the access for Supabase by configuring
)}
<EmptyIntegrationConnection
onClick={() => onAddVercelConnection(integration.id)}
+ orgSlug={org?.slug}
>
Add new project connection
</EmptyIntegrationConnection>
diff --git a/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsx b/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsx
index 619e4cce7f6..31df2b56070 100644
--- a/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsx
+++ b/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingModal.tsx
@@ -17,7 +17,6 @@ import AlertError from 'components/ui/AlertError'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
import { useBranchCreateMutation } from 'data/branches/branch-create-mutation'
import { useOrgIntegrationsQuery } from 'data/integrations/integrations-query-org-only'
-import { IntegrationName } from 'data/integrations/integrations.types'
import { useSelectedOrganization, useStore } from 'hooks'
import { useAppStateSnapshot } from 'state/app-state'
import GithubRepositorySelection from './GithubRepositorySelection'
@@ -29,7 +28,6 @@ const EnableBranchingModal = () => {
const snap = useAppStateSnapshot()
const [selectedBranch, setSelectedBranch] = useState<string>()
- const [addConnectionType, setAddConnectionType] = useState<IntegrationName>()
const isOrgBilling = !!selectedOrg?.subscription_id
@@ -59,18 +57,9 @@ const EnableBranchingModal = () => {
const githubIntegration = integrations?.find(
(integration) =>
integration.integration.name === 'GitHub' &&
- integration.connections.some((connection) => connection.supabase_project_ref === ref)
+ integration.organization.slug === selectedOrg?.slug
)
- // [Joshen] Leaving this out first
- // const hasVercelIntegrationInstalled =
- // integrations?.some((integration) => integration.integration.name === 'Vercel') ?? false
- // const vercelIntegration = integrations?.find(
- // (integration) =>
- // integration.integration.name === 'Vercel' &&
- // integration.connections.some((connection) => connection.supabase_project_ref === ref)
- // )
-
const onEnableBranching = () => {
if (!ref) return console.error('Project ref is required')
if (!selectedBranch) return console.error('No branch selected')
@@ -160,7 +149,6 @@ const EnableBranchingModal = () => {
hasGithubIntegrationInstalled={hasGithubIntegrationInstalled}
setSelectedBranch={setSelectedBranch}
/>
- {/* <VercelProjectSelection integration={vercelIntegration} /> */}
</>
)}
diff --git a/studio/components/layouts/AppLayout/EnableBranchingButton/GithubRepositorySelection.tsx b/studio/components/layouts/AppLayout/EnableBranchingButton/GithubRepositorySelection.tsx
index 0da519b6c51..1a7ccceaede 100644
--- a/studio/components/layouts/AppLayout/EnableBranchingButton/GithubRepositorySelection.tsx
+++ b/studio/components/layouts/AppLayout/EnableBranchingButton/GithubRepositorySelection.tsx
@@ -28,6 +28,7 @@ import ShimmeringLoader from 'components/ui/ShimmeringLoader'
import { useGithubBranchesQuery } from 'data/integrations/integrations-github-branches-query'
import { Integration } from 'data/integrations/integrations.types'
import { useSidePanelsStateSnapshot } from 'state/side-panels'
+import { useSelectedOrganization } from 'hooks'
interface GithubRepositorySelectionProps {
integration?: Integration
@@ -42,6 +43,7 @@ const GithubRepositorySelection = ({
hasGithubIntegrationInstalled,
setSelectedBranch,
}: GithubRepositorySelectionProps) => {
+ const org = useSelectedOrganization()
const { ref } = useParams()
const [open, setOpen] = useState(false)
const comboBoxRef = useRef<HTMLButtonElement>(null)
@@ -54,10 +56,10 @@ const GithubRepositorySelection = ({
const sidePanels = useSidePanelsStateSnapshot()
const githubIntegrationAppUrl =
process.env.NEXT_PUBLIC_ENVIRONMENT === 'prod'
- ? ' https://github.com/apps/supabase'
+ ? `https://github.com/apps/supabase/installations/new?state=${ref}`
: process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging'
- ? 'https://github.com/apps/supabase-staging'
- : 'https://github.com/apps/supabase-local-testing'
+ ? `https://github.com/apps/supabase-staging/installations/new?state=${ref}`
+ : `https://github.com/apps/supabase-local-testing/installations/new?state=${ref}`
const {
data: githubBranches,
@@ -98,7 +100,7 @@ const GithubRepositorySelection = ({
</p>
{!hasGithubIntegrationInstalled && (
<Link passHref href={githubIntegrationAppUrl}>
- <a target="_blank" rel="noreferrer">
+ <a>
<Button type="default" className="!mt-3">
Install Github Integration
</Button>
@@ -106,7 +108,11 @@ const GithubRepositorySelection = ({
</Link>
)}
{hasGithubIntegrationInstalled && !githubConnection && (
- <EmptyIntegrationConnection showNode={false} onClick={() => onSelectConnectRepo()} />
+ <EmptyIntegrationConnection
+ showNode={false}
+ onClick={() => onSelectConnectRepo()}
+ orgSlug={org?.slug}
+ />
)}
{integration && githubConnection && (
<>
diff --git a/studio/lib/github-integration.ts b/studio/lib/github-integration.ts
new file mode 100644
index 00000000000..b7ae7c28e75
--- /dev/null
+++ b/studio/lib/github-integration.ts
@@ -0,0 +1,74 @@
+import { useParams } from 'common'
+import { useGitHubIntegrationCreateMutation } from 'data/integrations/github-integration-create-mutation'
+import { useOrganizationsQuery } from 'data/organizations/organizations-query'
+import { useProjectsQuery } from 'data/projects/projects-query'
+import { useEffect, useState } from 'react'
+
+export function useGitHubIntegrationAutoInstall(callback?: (id: string, orgSlug: string) => void) {
+ const { installation_id: installationId, state: projectRef } = useParams()
+ const shouldAttemptInstall = projectRef !== undefined && installationId !== undefined
+
+ const [isAutoInstalling, setIsAutoInstalling] = useState(false)
+
+ const { data: projects, isSuccess: isProjectsSuccess } = useProjectsQuery({
+ enabled: shouldAttemptInstall,
+ })
+ const { data: organizations, isSuccess: isOrganizationsSuccess } = useOrganizationsQuery({
+ enabled: shouldAttemptInstall,
+ })
+
+ const { mutate: createIntegration } = useGitHubIntegrationCreateMutation()
+
+ useEffect(() => {
+ async function autoInstall() {
+ if (shouldAttemptInstall) {
+ setIsAutoInstalling(true)
+ }
+
+ if (projectRef && isProjectsSuccess && isOrganizationsSuccess) {
+ const project = projects.find((x) => x.ref === projectRef)
+ const organization = organizations.find((x) => x.id === project?.organization_id)
+
+ if (project && organization) {
+ createIntegration(
+ {
+ installationId: Number(installationId),
+ orgSlug: organization.slug,
+ metadata: {
+ supabaseConfig: {
+ supabaseDirectory: '/supabase',
+ },
+ },
+ },
+ {
+ onSuccess({ id }) {
+ setIsAutoInstalling(false)
+
+ callback?.(id, organization.slug)
+ },
+ onError() {
+ setIsAutoInstalling(false)
+ },
+ }
+ )
+ } else {
+ setIsAutoInstalling(false)
+ }
+ }
+ }
+
+ autoInstall()
+ }, [
+ callback,
+ createIntegration,
+ installationId,
+ isOrganizationsSuccess,
+ isProjectsSuccess,
+ organizations,
+ projectRef,
+ projects,
+ shouldAttemptInstall,
+ ])
+
+ return isAutoInstalling
+}
diff --git a/studio/pages/integrations/github/[integrationId]/choose-project.tsx b/studio/pages/integrations/github/[integrationId]/choose-project.tsx
index 6c170e62916..875eb39ec69 100644
--- a/studio/pages/integrations/github/[integrationId]/choose-project.tsx
+++ b/studio/pages/integrations/github/[integrationId]/choose-project.tsx
@@ -26,7 +26,7 @@ const GITHUB_ICON = (
const ChooseProjectGitHubPage: NextPageWithLayout = () => {
const router = useRouter()
- const { integrationId, slug, organizationSlug } = useParams()
+ const { integrationId, slug, organizationSlug, state: projectRef } = useParams()
const orgSlug = slug ?? organizationSlug
const { data: integrations } = useOrgIntegrationsQuery({
@@ -58,11 +58,17 @@ const ChooseProjectGitHubPage: NextPageWithLayout = () => {
[allRepos]
)
+ function onDone() {
+ if (projectRef) {
+ router.push(`/project/${projectRef}?enableBranching=true`)
+ } else {
+ router.push(`/org/${orgSlug}/integrations`)
+ }
+ }
+
const { mutate: createConnections, isLoading: isCreatingConnection } =
useIntegrationGitHubConnectionsCreateMutation({
- onSuccess() {
- router.push(`/org/${orgSlug}/integrations`)
- },
+ onSuccess: onDone,
})
return (
@@ -92,11 +98,10 @@ This Supabase integration will allow you to link a Supabase project to a GitHub
isLoading={isCreatingConnection}
integrationIcon={GITHUB_ICON}
choosePrompt="Choose GitHub Repo"
- onSkip={() => {
- router.push(`/org/${orgSlug}/integrations`)
- }}
+ onSkip={onDone}
loadingForeignProjects={isLoadingGithubReposData}
loadingSupabaseProjects={isLoadingSupabaseProjectsData}
+ defaultSupabaseProjectRef={projectRef}
/>
</ScaffoldContainer>
</>
diff --git a/studio/pages/integrations/github/install.tsx b/studio/pages/integrations/github/install.tsx
index 902c5e56b00..71c75de64ce 100644
--- a/studio/pages/integrations/github/install.tsx
+++ b/studio/pages/integrations/github/install.tsx
@@ -1,5 +1,5 @@
import { useRouter } from 'next/router'
-import { useMemo, useState } from 'react'
+import { useCallback, useMemo, useState } from 'react'
import { useParams } from 'common'
import OrganizationPicker from 'components/interfaces/Integrations/OrganizationPicker'
@@ -23,13 +23,13 @@ import {
IconLifeBuoy,
LoadingLine,
} from 'ui'
+import { useGitHubIntegrationAutoInstall } from 'lib/github-integration'
const GitHubIntegration: NextPageWithLayout = () => {
const router = useRouter()
const { ui } = useStore()
const { installation_id: installationId } = useParams()
const [selectedOrg, setSelectedOrg] = useState<Organization | null>(null)
- const [organizationIntegrationId, setOrganizationIntegrationId] = useState<string | null>(null)
/**
* Fetch the list of organization based integration installations for GitHub.
@@ -48,18 +48,25 @@ const GitHubIntegration: NextPageWithLayout = () => {
},
})
+ const onInstalled = useCallback(
+ (id: string, orgSlug?: string) => {
+ router.push({
+ pathname: `/integrations/github/${id}/choose-project`,
+ query: { ...router.query, slug: orgSlug },
+ })
+ },
+ [router]
+ )
+
const { mutate, isLoading: isLoadingGitHubIntegrationCreateMutation } =
useGitHubIntegrationCreateMutation({
onSuccess({ id }) {
- setOrganizationIntegrationId(id)
-
- router.push({
- pathname: `/integrations/github/${id}/choose-project`,
- query: { ...router.query, slug: selectedOrg?.slug },
- })
+ onInstalled(id, selectedOrg?.slug)
},
})
+ const isAutoInstalling = useGitHubIntegrationAutoInstall(onInstalled)
+
const installed = useMemo(
() =>
integrationData && organizationsData
@@ -119,61 +126,55 @@ const GitHubIntegration: NextPageWithLayout = () => {
return (
<>
<main className="overflow-auto flex flex-col h-full bg">
- <LoadingLine loading={isLoadingGitHubIntegrationCreateMutation} />
- {organizationIntegrationId === null && (
- <>
- <ScaffoldContainer className="flex flex-col gap-6 grow py-8">
- <ScaffoldColumn className="mx-auto">
- <h1 className="text-xl text-foreground">Choose organization</h1>
- <>
- <Markdown content={`Choose the Supabase organization you wish to install in`} />
- <OrganizationPicker
- integrationName="GitHub"
- selectedOrg={selectedOrg}
- onSelectedOrgChange={(org) => {
- router.query.organizationSlug = org.slug
- setSelectedOrg(org)
- }}
- configurationId={installationId}
- />
- {disableInstallationForm && (
- <Alert_Shadcn_ variant="warning">
- <IconAlertTriangle className="h-4 w-4" strokeWidth={2} />
- <AlertTitle_Shadcn_>
- GitHub Integration is already installed.
- </AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_>
- You will need to choose another organization to install the integration.
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
- )}
- <div className="flex flex-row w-full justify-end">
- <Button
- size="medium"
- className="self-end"
- disabled={isLoadingGitHubIntegrationCreateMutation || disableInstallationForm}
- loading={isLoadingGitHubIntegrationCreateMutation}
- onClick={onInstall}
- >
- Install integration
- </Button>
- </div>
- </>
- </ScaffoldColumn>
- </ScaffoldContainer>
- <ScaffoldContainer className="flex flex-col gap-6 py-3">
- <Alert
- withIcon
- variant="info"
- title="You can uninstall this Integration at any time."
- >
- <Markdown
- content={`Remove this integration at any time via GitHub or the Supabase dashboard.`}
- />
- </Alert>
- </ScaffoldContainer>
- </>
- )}
+ <LoadingLine loading={isLoadingGitHubIntegrationCreateMutation || isAutoInstalling} />
+ <ScaffoldContainer className="flex flex-col gap-6 grow py-8">
+ <ScaffoldColumn className="mx-auto">
+ <h1 className="text-xl text-foreground">Choose organization</h1>
+ <>
+ <Markdown content={`Choose the Supabase organization you wish to install in`} />
+ <OrganizationPicker
+ integrationName="GitHub"
+ selectedOrg={selectedOrg}
+ onSelectedOrgChange={(org) => {
+ router.query.organizationSlug = org.slug
+ setSelectedOrg(org)
+ }}
+ configurationId={installationId}
+ />
+ {disableInstallationForm && (
+ <Alert_Shadcn_ variant="warning">
+ <IconAlertTriangle className="h-4 w-4" strokeWidth={2} />
+ <AlertTitle_Shadcn_>GitHub Integration is already installed.</AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ You will need to choose another organization to install the integration.
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
+ )}
+ <div className="flex flex-row w-full justify-end">
+ <Button
+ size="medium"
+ className="self-end"
+ disabled={
+ isLoadingGitHubIntegrationCreateMutation ||
+ isAutoInstalling ||
+ disableInstallationForm
+ }
+ loading={isLoadingGitHubIntegrationCreateMutation || isAutoInstalling}
+ onClick={onInstall}
+ >
+ Install integration
+ </Button>
+ </div>
+ </>
+ </ScaffoldColumn>
+ </ScaffoldContainer>
+ <ScaffoldContainer className="flex flex-col gap-6 py-3">
+ <Alert withIcon variant="info" title="You can uninstall this Integration at any time.">
+ <Markdown
+ content={`Remove this integration at any time via GitHub or the Supabase dashboard.`}
+ />
+ </Alert>
+ </ScaffoldContainer>
<ScaffoldDivider />
</main>
diff --git a/studio/pages/project/[ref]/index.tsx b/studio/pages/project/[ref]/index.tsx
index fec5390e75e..3eb31cc7e5d 100644
--- a/studio/pages/project/[ref]/index.tsx
+++ b/studio/pages/project/[ref]/index.tsx
@@ -1,3 +1,6 @@
+import { useEffect, useRef } from 'react'
+
+import { useParams } from 'common'
import { ClientLibrary, ExampleProject } from 'components/interfaces/Home'
import { CLIENT_LIBRARIES, EXAMPLE_PROJECTS } from 'components/interfaces/Home/Home.constants'
import ProjectUsageSection from 'components/interfaces/Home/ProjectUsageSection'
@@ -7,11 +10,24 @@ import ProjectPausedState from 'components/layouts/ProjectLayout/ProjectPausedSt
import ProjectUpgradeFailedBanner from 'components/ui/ProjectUpgradeFailedBanner'
import { useSelectedProject } from 'hooks'
import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'
+import { useAppStateSnapshot } from 'state/app-state'
import { NextPageWithLayout } from 'types'
const Home: NextPageWithLayout = () => {
const project = useSelectedProject()
+ const snap = useAppStateSnapshot()
+ const { enableBranching } = useParams()
+
+ const hasShownEnableBranchingModalRef = useRef(false)
+ useEffect(() => {
+ if (enableBranching && !hasShownEnableBranchingModalRef.current) {
+ hasShownEnableBranchingModalRef.current = true
+ snap.setShowEnableBranchingModal(true)
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [enableBranching])
+
const projectName =
project?.ref !== 'default' && project?.name !== undefined
? project?.name