Skip to content

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

Use isLoading from RQ mutation instead of a separate state

Joshen Limf818c7e1c750
diff --git a/studio/components/interfaces/Organization/OAuthApps/DeleteAppModal.tsx b/studio/components/interfaces/Organization/OAuthApps/DeleteAppModal.tsx
index 86d1c3a3c1c..4cc29703d3e 100644
--- a/studio/components/interfaces/Organization/OAuthApps/DeleteAppModal.tsx
+++ b/studio/components/interfaces/Organization/OAuthApps/DeleteAppModal.tsx
@@ -2,7 +2,6 @@ import { useParams } from 'common'
import { useOAuthAppDeleteMutation } from 'data/oauth/oauth-app-delete-mutation'
import { OAuthApp } from 'data/oauth/oauth-apps-query'
import { useStore } from 'hooks'
-import { useEffect, useState } from 'react'
import { Alert, Modal } from 'ui'
export interface DeleteAppModalProps {
@@ -13,19 +12,13 @@ export interface DeleteAppModalProps {
const DeleteAppModal = ({ selectedApp, onClose }: DeleteAppModalProps) => {
const { ui } = useStore()
const { slug } = useParams()
- const [isDeleting, setIsDeleting] = useState(false)
- const { mutateAsync: deleteOAuthApp } = useOAuthAppDeleteMutation()
-
- useEffect(() => {
- if (selectedApp) setIsDeleting(false)
- }, [selectedApp])
+ const { mutateAsync: deleteOAuthApp, isLoading: isDeleting } = useOAuthAppDeleteMutation()
const onConfirmDelete = async () => {
if (!slug) return console.error('Slug is required')
if (!selectedApp?.id) return console.error('App ID is required')
try {
- setIsDeleting(true)
await deleteOAuthApp({ slug, id: selectedApp?.id })
ui.setNotification({
category: 'success',
@@ -37,7 +30,6 @@ const DeleteAppModal = ({ selectedApp, onClose }: DeleteAppModalProps) => {
category: 'error',
message: `Failed to delete OAuth app: ${(error as any).message}`,
})
- setIsDeleting(false)
}
}