Skip to content

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

Fix so can change prod branch (#37937)

Saxon Fletcher0952d46d4023
diff --git a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
index 9d7255035e5..2c604636847 100644
--- a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
+++ b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx
@@ -89,8 +89,15 @@ const GitHubIntegrationConnectionForm = ({
enabled: Boolean(gitHubAuthorization),
})
- const { mutate: updateBranch } = useBranchUpdateMutation()
+ const { mutate: updateBranch } = useBranchUpdateMutation({
+ onSuccess: () => {
+ toast.success('Production branch settings successfully updated')
+ },
+ })
const { mutate: createBranch } = useBranchCreateMutation({
+ onSuccess: () => {
+ toast.success('Production branch settings successfully updated')
+ },
onError: (error) => {
console.error('Failed to enable branching:', error)
},
@@ -105,7 +112,11 @@ const GitHubIntegrationConnectionForm = ({
useCheckGithubBranchValidity({ onError: () => {} })
const { mutate: createConnection, isLoading: isCreatingConnection } =
- useGitHubConnectionCreateMutation()
+ useGitHubConnectionCreateMutation({
+ onSuccess: () => {
+ toast.success('GitHub integration successfully updated')
+ },
+ })
const { mutateAsync: deleteConnection, isLoading: isDeletingConnection } =
useGitHubConnectionDeleteMutation({
@@ -245,7 +256,6 @@ const GitHubIntegrationConnectionForm = ({
gitBranch: data.branchName,
})
}
- toast.success('GitHub integration successfully updated')
}
const handleUpdateConnection = async (
@@ -289,7 +299,6 @@ const GitHubIntegrationConnectionForm = ({
})
}
- toast.success('GitHub integration successfully updated')
setIsConfirmingBranchChange(false)
}
@@ -344,15 +353,6 @@ const GitHubIntegrationConnectionForm = ({
}
}
- useEffect(() => {
- if (selectedRepository) {
- githubSettingsForm.setValue(
- 'branchName',
- githubRepos.find((repo) => repo.id === selectedRepository.id)?.default_branch || 'main'
- )
- }
- }, [selectedRepository])
-
useEffect(() => {
if (connection) {
const hasGitBranch = Boolean(prodBranch?.git_branch?.trim())
@@ -463,6 +463,10 @@ const GitHubIntegrationConnectionForm = ({
onSelect={() => {
field.onChange(repo.id)
setRepoComboboxOpen(false)
+ githubSettingsForm.setValue(
+ 'branchName',
+ repo.default_branch || 'main'
+ )
}}
>
<div className="bg-black shadow rounded p-1 w-5 h-5 flex justify-center items-center">