The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(studio):Synced Git Branch now shows error message (#42790)
Aaron Byrnefcdff89e13a1
diff --git a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsxindex 50631d6e6b1..c1c80df0652 100644--- a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx+++ b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx@@ -236,6 +236,17 @@ export const CreateBranchModal = () => {{onSuccess: () => {if (form.getValues('gitBranchName') !== branchName) return++ // Check if another branch is already linked to this git branch+ const existingBranch = (branches ?? []).find((b) => b.git_branch === branchName)+ if (existingBranch) {+ setIsGitBranchValid(false)+ form.setError('gitBranchName', {+ message: `Branch "${existingBranch.name}" is already linked to git branch "${branchName}"`,+ })+ return+ }+setIsGitBranchValid(true)form.clearErrors('gitBranchName')},@@ -250,7 +261,7 @@ export const CreateBranchModal = () => {})},- [githubConnection, form, checkGithubBranchValidity, repoOwner, repoName]+ [githubConnection, form, checkGithubBranchValidity, repoOwner, repoName, branches])const onSubmit = (data: z.infer<typeof FormSchema>) => {diff --git a/apps/studio/components/interfaces/BranchManagement/EditBranchModal.tsx b/apps/studio/components/interfaces/BranchManagement/EditBranchModal.tsxindex bb290791dd6..eeb573b8326 100644--- a/apps/studio/components/interfaces/BranchManagement/EditBranchModal.tsx+++ b/apps/studio/components/interfaces/BranchManagement/EditBranchModal.tsx@@ -167,6 +167,19 @@ export const EditBranchModal = ({ branch, visible, onClose }: EditBranchModalPro{onSuccess: () => {if (form.getValues('gitBranchName') !== requested) return++ // Check if another branch is already linked to this git branch+ const existingBranch = (branches ?? []).find(+ (b) => b.git_branch === branchName && b.id !== branch?.id+ )+ if (existingBranch) {+ setIsGitBranchValid(false)+ form.setError('gitBranchName', {+ message: `Branch "${existingBranch.name}" is already linked to git branch "${branchName}"`,+ })+ return+ }+setIsGitBranchValid(true)form.clearErrors('gitBranchName')},@@ -181,7 +194,7 @@ export const EditBranchModal = ({ branch, visible, onClose }: EditBranchModalPro})},- [githubConnection, form, checkGithubBranchValidity, repoOwner, repoName]+ [githubConnection, form, checkGithubBranchValidity, repoOwner, repoName, branches, branch])// Pre-fill form when the modal becomes visible and branch data is available