The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Merge branch 'master' into chore/add-branch-dropdown-in-nav-v1
Jonathan Summers-Muir0ee793cb5ead
diff --cc studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingButton.tsxindex b3445c1261a,af857abb4f5..fbadc30828b--- a/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingButton.tsx+++ b/studio/components/layouts/AppLayout/EnableBranchingButton/EnableBranchingButton.tsx@@@ -1,22 -1,78 +1,24 @@@-import { useParams } from 'common'-import { useEffect, useState } from 'react'-import { Button, IconFileText, IconGitBranch, Modal } from 'ui'+import { Button, IconGitBranch } from 'ui'-import SidePanelGitHubRepoLinker from 'components/interfaces/Organization/IntegrationSettings/SidePanelGitHubRepoLinker'-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 { useSelectedOrganization } from 'hooks'import { useAppUiStateSnapshot } from 'state/app'import BranchingWaitlistPopover from './BranchingWaitlistPopover'-import GithubRepositorySelection from './GithubRepositorySelection'-import VercelProjectSelection from './VercelProjectSelection'++ import { OPT_IN_TAGS } from 'lib/constants'+-const EnableBranchingButton = () => {- const { ui } = useStore()- const { ref } = useParams()- const selectedOrg = useSelectedOrganization()+interface EnableBranchingButtonProps {+ alt?: boolean+}+const EnableBranchingButton = ({ alt = false }: EnableBranchingButtonProps) => {const snap = useAppUiStateSnapshot()- const [selectedBranch, setSelectedBranch] = useState<string>()- const [addConnectionType, setAddConnectionType] = useState<IntegrationName>()-- useEffect(() => {- if (snap.showEnableBranchingModal) setSelectedBranch(undefined)- }, [snap.showEnableBranchingModal])-- const {- data: integrations,- error: integrationsError,- isLoading: isLoadingIntegrations,- isSuccess: isSuccessIntegrations,- isError: isErrorIntegrations,- } = useOrgIntegrationsQuery({- orgSlug: selectedOrg?.slug,- })-- const { mutate: createBranch, isLoading: isCreating } = useBranchCreateMutation({- onSuccess: () => {- ui.setNotification({ category: 'success', message: `Successfully created new branch` })- snap.setShowEnableBranchingModal(false)- },- })+ const selectedOrg = useSelectedOrganization()const hasAccessToBranching =- selectedOrg?.opt_in_tags?.includes('PREVIEW_BRANCHES_OPT_IN') ?? false+ selectedOrg?.opt_in_tags?.includes(OPT_IN_TAGS.PREVIEW_BRANCHES) ?? false- const hasGithubIntegrationInstalled =- integrations?.some((integration) => integration.integration.name === 'GitHub') ?? false- const githubIntegration = integrations?.find(- (integration) =>- integration.integration.name === 'GitHub' &&- integration.connections.some((connection) => connection.supabase_project_ref === ref)- )-- // [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')- createBranch({ projectRef: ref, branchName: selectedBranch, gitBranch: selectedBranch })- }-if (!hasAccessToBranching) {- return <BranchingWaitlistPopover />+ return <BranchingWaitlistPopover alt={alt} />}return (