Skip to content

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

Change mutateAsync to mutate in IntegrationSettings and IntegrationsSettings

Joshen Lime62a72ec6e58
diff --git a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
index 875b0d672b7..6d13740ebfd 100644
--- a/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
+++ b/studio/components/interfaces/Organization/IntegrationSettings/IntegrationSettings.tsx
@@ -1,8 +1,18 @@
+import Link from 'next/link'
+import { useCallback, useMemo } from 'react'
+import { Button, IconExternalLink } from 'ui'
+
+import {
+ EmptyIntegrationConnection,
+ IntegrationConnectionHeader,
+ IntegrationInstallation,
+} from 'components/interfaces/Integrations/IntegrationPanels'
+import { Markdown } from 'components/interfaces/Markdown'
import {
ScaffoldContainer,
ScaffoldDivider,
- ScaffoldSectionContent,
ScaffoldSection,
+ ScaffoldSectionContent,
ScaffoldSectionDetail,
} from 'components/layouts/Scaffold'
import { useIntegrationsGitHubInstalledConnectionDeleteMutation } from 'data/integrations/integrations-github-connection-delete-mutation'
@@ -10,23 +20,14 @@ import { useOrgIntegrationsQuery } from 'data/integrations/integrations-query-or
import { useIntegrationsVercelInstalledConnectionDeleteMutation } from 'data/integrations/integrations-vercel-installed-connection-delete-mutation'
import { useVercelProjectsQuery } from 'data/integrations/integrations-vercel-projects-query'
import { IntegrationName, IntegrationProjectConnection } from 'data/integrations/integrations.types'
+import { useSelectedOrganization, useStore } from 'hooks'
+import { BASE_PATH } from 'lib/constants'
+import { pluralize } from 'lib/helpers'
import { getIntegrationConfigurationUrl } from 'lib/integration-utils'
-import { useCallback, useMemo } from 'react'
+import { useSidePanelsStateSnapshot } from 'state/side-panels'
import { IntegrationConnectionItem } from '../../Integrations/IntegrationConnection'
import SidePanelGitHubRepoLinker from './SidePanelGitHubRepoLinker'
import SidePanelVercelProjectLinker from './SidePanelVercelProjectLinker'
-import { useSelectedOrganization } from 'hooks'
-import { useSidePanelsStateSnapshot } from 'state/side-panels'
-import { Markdown } from 'components/interfaces/Markdown'
-import { BASE_PATH } from 'lib/constants'
-import {
- EmptyIntegrationConnection,
- IntegrationConnectionHeader,
- IntegrationInstallation,
-} from 'components/interfaces/Integrations/IntegrationPanels'
-import { pluralize } from 'lib/helpers'
-import { Button, IconExternalLink } from 'ui'
-import Link from 'next/link'
const IntegrationImageHandler = ({ title }: { title: 'vercel' | 'github' }) => {
return (
@@ -39,10 +40,33 @@ const IntegrationImageHandler = ({ title }: { title: 'vercel' | 'github' }) => {
}
const IntegrationSettings = () => {
+ const { ui } = useStore()
const org = useSelectedOrganization()
const { data } = useOrgIntegrationsQuery({ orgSlug: org?.slug })
const sidePanelsStateSnapshot = useSidePanelsStateSnapshot()
+ const { mutate: deleteVercelConnection } = useIntegrationsVercelInstalledConnectionDeleteMutation(
+ {
+ onSuccess: () => {
+ ui.setNotification({
+ category: 'success',
+ message: 'Successfully deleted Vercel connection',
+ })
+ },
+ }
+ )
+
+ const { mutate: deleteGitHubConnection } = useIntegrationsGitHubInstalledConnectionDeleteMutation(
+ {
+ onSuccess: () => {
+ ui.setNotification({
+ category: 'success',
+ message: 'Successfully deleted Github connection',
+ })
+ },
+ }
+ )
+
const vercelIntegrations = useMemo(() => {
return data
?.filter((integration) => integration.integration.name === 'Vercel')
@@ -91,12 +115,9 @@ const IntegrationSettings = () => {
[sidePanelsStateSnapshot]
)
- const { mutateAsync: deleteVercelConnection } =
- useIntegrationsVercelInstalledConnectionDeleteMutation()
-
const onDeleteVercelConnection = useCallback(
async (connection: IntegrationProjectConnection) => {
- await deleteVercelConnection({
+ deleteVercelConnection({
id: connection.id,
organization_integration_id: connection.organization_integration_id,
orgSlug: org?.slug,
@@ -105,12 +126,9 @@ const IntegrationSettings = () => {
[deleteVercelConnection, org?.slug]
)
- const { mutateAsync: deleteGitHubConnection } =
- useIntegrationsGitHubInstalledConnectionDeleteMutation()
-
const onDeleteGitHubConnection = useCallback(
async (connection: IntegrationProjectConnection) => {
- await deleteGitHubConnection({
+ deleteGitHubConnection({
connectionId: connection.id,
integrationId: connection.organization_integration_id,
orgSlug: org?.slug,
diff --git a/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsx b/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsx
index 105be3859d2..b0877ad4755 100644
--- a/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsx
+++ b/studio/components/interfaces/Settings/Integrations/IntegrationsSettings.tsx
@@ -1,41 +1,8 @@
import { zodResolver } from '@hookform/resolvers/zod'
-import {
- EmptyIntegrationConnection,
- IntegrationConnectionHeader,
- IntegrationInstallation,
-} from 'components/interfaces/Integrations/IntegrationPanels'
-import { Markdown } from 'components/interfaces/Markdown'
-import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
-import {
- ScaffoldContainer,
- ScaffoldDivider,
- ScaffoldSection,
- ScaffoldSectionContent,
- ScaffoldSectionDetail,
-} from 'components/layouts/Scaffold'
-import { useBranchUpdateMutation } from 'data/branches/branch-update-mutation'
-import { useBranchesQuery } from 'data/branches/branches-query'
-import { useGithubConnectionUpdateMutation } from 'data/integrations/github-connection-update-mutate'
-import { useGithubBranchesQuery } from 'data/integrations/integrations-github-branches-query'
-import { useIntegrationsGitHubInstalledConnectionDeleteMutation } from 'data/integrations/integrations-github-connection-delete-mutation'
-import { useOrgIntegrationsQuery } from 'data/integrations/integrations-query-org-only'
-import { useIntegrationsVercelInstalledConnectionDeleteMutation } from 'data/integrations/integrations-vercel-installed-connection-delete-mutation'
-import { useVercelProjectsQuery } from 'data/integrations/integrations-vercel-projects-query'
-import {
- Integration,
- IntegrationName,
- IntegrationProjectConnection,
-} from 'data/integrations/integrations.types'
-import { useVercelConnectionUpdateMutation } from 'data/integrations/vercel-connection-update-mutate'
-import { useFlag, useSelectedOrganization, useStore } from 'hooks'
-import { BASE_PATH } from 'lib/constants'
-import { pluralize } from 'lib/helpers'
-import { getIntegrationConfigurationUrl } from 'lib/integration-utils'
import { GitBranch, RotateCcw, Shield } from 'lucide-react'
import Link from 'next/link'
import { useCallback, useMemo, useRef, useState } from 'react'
import { useForm } from 'react-hook-form'
-import { useSidePanelsStateSnapshot } from 'state/side-panels'
import {
AlertDescription_Shadcn_,
AlertTitle_Shadcn_,
@@ -66,6 +33,40 @@ import {
cn,
} from 'ui'
import * as z from 'zod'
+
+import {
+ EmptyIntegrationConnection,
+ IntegrationConnectionHeader,
+ IntegrationInstallation,
+} from 'components/interfaces/Integrations/IntegrationPanels'
+import { Markdown } from 'components/interfaces/Markdown'
+import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
+import {
+ ScaffoldContainer,
+ ScaffoldDivider,
+ ScaffoldSection,
+ ScaffoldSectionContent,
+ ScaffoldSectionDetail,
+} from 'components/layouts/Scaffold'
+import { useBranchUpdateMutation } from 'data/branches/branch-update-mutation'
+import { useBranchesQuery } from 'data/branches/branches-query'
+import { useGithubConnectionUpdateMutation } from 'data/integrations/github-connection-update-mutate'
+import { useGithubBranchesQuery } from 'data/integrations/integrations-github-branches-query'
+import { useIntegrationsGitHubInstalledConnectionDeleteMutation } from 'data/integrations/integrations-github-connection-delete-mutation'
+import { useOrgIntegrationsQuery } from 'data/integrations/integrations-query-org-only'
+import { useIntegrationsVercelInstalledConnectionDeleteMutation } from 'data/integrations/integrations-vercel-installed-connection-delete-mutation'
+import { useVercelProjectsQuery } from 'data/integrations/integrations-vercel-projects-query'
+import {
+ Integration,
+ IntegrationName,
+ IntegrationProjectConnection,
+} from 'data/integrations/integrations.types'
+import { useVercelConnectionUpdateMutation } from 'data/integrations/vercel-connection-update-mutate'
+import { useFlag, useSelectedOrganization, useStore } from 'hooks'
+import { BASE_PATH } from 'lib/constants'
+import { pluralize } from 'lib/helpers'
+import { getIntegrationConfigurationUrl } from 'lib/integration-utils'
+import { useSidePanelsStateSnapshot } from 'state/side-panels'
import { IntegrationConnectionItem } from '../../Integrations/IntegrationConnection'
import SidePanelGitHubRepoLinker from './../../Organization/IntegrationSettings/SidePanelGitHubRepoLinker'
import SidePanelVercelProjectLinker from './../../Organization/IntegrationSettings/SidePanelVercelProjectLinker'
@@ -81,11 +82,33 @@ const IntegrationImageHandler = ({ title }: { title: 'vercel' | 'github' }) => {
}
const IntegrationSettings = () => {
+ const { ui } = useStore()
const org = useSelectedOrganization()
+ const projectContext = useProjectContext()
const { data } = useOrgIntegrationsQuery({ orgSlug: org?.slug })
const sidePanelsStateSnapshot = useSidePanelsStateSnapshot()
- const projectContext = useProjectContext()
+ const { mutate: deleteVercelConnection } = useIntegrationsVercelInstalledConnectionDeleteMutation(
+ {
+ onSuccess: () => {
+ ui.setNotification({
+ category: 'success',
+ message: 'Successfully deleted Vercel connection',
+ })
+ },
+ }
+ )
+
+ const { mutate: deleteGitHubConnection } = useIntegrationsGitHubInstalledConnectionDeleteMutation(
+ {
+ onSuccess: () => {
+ ui.setNotification({
+ category: 'success',
+ message: 'Successfully deleted Github connection',
+ })
+ },
+ }
+ )
const vercelIntegrations = useMemo(() => {
return data
@@ -135,12 +158,9 @@ const IntegrationSettings = () => {
[sidePanelsStateSnapshot]
)
- const { mutateAsync: deleteVercelConnection } =
- useIntegrationsVercelInstalledConnectionDeleteMutation()
-
const onDeleteVercelConnection = useCallback(
async (connection: IntegrationProjectConnection) => {
- await deleteVercelConnection({
+ deleteVercelConnection({
id: connection.id,
organization_integration_id: connection.organization_integration_id,
orgSlug: org?.slug,
@@ -149,12 +169,9 @@ const IntegrationSettings = () => {
[deleteVercelConnection, org?.slug]
)
- const { mutateAsync: deleteGitHubConnection } =
- useIntegrationsGitHubInstalledConnectionDeleteMutation()
-
const onDeleteGitHubConnection = useCallback(
async (connection: IntegrationProjectConnection) => {
- await deleteGitHubConnection({
+ deleteGitHubConnection({
connectionId: connection.id,
integrationId: connection.organization_integration_id,
orgSlug: org?.slug,
@@ -640,14 +657,14 @@ These connections will be part of a GitHub workflow that is currently in develop
},
})
+<<<<<<< HEAD
+=======
+>>>>>>> 07e830144 (Change mutateAsync to mutate in IntegrationSettings and IntegrationsSettings)
const { mutate: updateGithubConnection, isLoading: isUpdatingGithubConnection } =
useGithubConnectionUpdateMutation({
- onSuccess: (data) => {
- ui.setNotification({
- category: 'success',
- message: `Updated Supabase directory`,
- })
+ onSuccess: () => {
+ ui.setNotification({ category: 'success', message: `Updated Supabase directory` })
setOpen(false)
},
})