The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: vercel integration create project flow (#29456)
Alaister Youngcbda650c66c6
diff --git a/apps/studio/data/config/project-api-query.ts b/apps/studio/data/config/project-api-query.tsindex 4aabfe86796..8baaee61d0d 100644--- a/apps/studio/data/config/project-api-query.ts+++ b/apps/studio/data/config/project-api-query.ts@@ -2,10 +2,10 @@ import { useQuery, UseQueryOptions } from '@tanstack/react-query'import { components } from 'api-types'import { get, handleError } from 'data/fetchers'+import { useProjectByRef } from 'hooks/misc/useSelectedProject'+import { PROJECT_STATUS } from 'lib/constants'import type { ResponseError } from 'types'import { configKeys } from './keys'-import { useSelectedProject } from 'hooks/misc/useSelectedProject'-import { PROJECT_STATUS } from 'lib/constants'export type ProjectApiVariables = {projectRef?: string@@ -19,7 +19,6 @@ export type ProjectApiResponse = {export async function getProjectApi({ projectRef }: ProjectApiVariables, signal?: AbortSignal) {if (!projectRef) throw new Error('projectRef is required')- console.log('SSS')const { data, error } = await get('/platform/props/project/{ref}/api', {params: { path: { ref: projectRef } },@@ -37,16 +36,12 @@ export const useProjectApiQuery = <TData = ProjectApiData>({ projectRef }: ProjectApiVariables,{ enabled = true, ...options }: UseQueryOptions<ProjectApiData, ProjectApiError, TData> = {}) => {- const project = useSelectedProject()return useQuery<ProjectApiData, ProjectApiError, TData>(configKeys.api(projectRef),({ signal }) => getProjectApi({ projectRef }, signal),{- enabled:- enabled &&- typeof projectRef !== 'undefined' &&- project?.status === PROJECT_STATUS.ACTIVE_HEALTHY,- refetchInterval(data, query) {+ enabled: enabled && typeof projectRef !== 'undefined',+ refetchInterval(data) {if (!data) {return false}diff --git a/apps/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx b/apps/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsxindex 6daec1ed3de..0334469cb30 100644--- a/apps/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx+++ b/apps/studio/pages/integrations/vercel/[slug]/deploy-button/new-project.tsx@@ -128,6 +128,8 @@ const CreateProject = () => {delayedCheckPasswordStrength(password)}+ const [newProjectRef, setNewProjectRef] = useState<string | undefined>(undefined)+const { mutate: createProject } = useProjectCreateMutation({onSuccess: (res) => {setNewProjectRef(res.ref)@@ -138,7 +140,6 @@ const CreateProject = () => {},})- const [newProjectRef, setNewProjectRef] = useState<string | undefined>(undefined)async function onCreateProject() {if (!organizationIntegration) return console.error('No organization installation details found')if (!organizationIntegration?.id) return console.error('No organization installation ID found')@@ -162,7 +163,6 @@ const CreateProject = () => {dbSql,})}- const isInstallingRef = useRef(false)// Wait for the new project to be created before creating the connectionuseProjectApiQuery(@@ -176,16 +176,9 @@ const CreateProject = () => {async onSuccess(data) {const isReady = data.autoApiService.service_api_keys.length > 0- if (- !isReady ||- !organizationIntegration ||- !foreignProjectId ||- !newProjectRef ||- isInstallingRef.current- ) {+ if (!isReady || !organizationIntegration || !foreignProjectId || !newProjectRef) {return}- isInstallingRef.current = trueconst projectDetails = vercelProjects?.find((x: any) => x.id === foreignProjectId)