The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add loading state when enabling hooks
Joshen Limb936fa12b58b
diff --git a/studio/components/to-be-cleaned/ProductEmptyState.tsx b/studio/components/to-be-cleaned/ProductEmptyState.tsxindex 09eaff00b57..ab85f4820cb 100644--- a/studio/components/to-be-cleaned/ProductEmptyState.tsx+++ b/studio/components/to-be-cleaned/ProductEmptyState.tsx@@ -9,6 +9,7 @@ interface ProductEmptyStateProps {infoButtonLabel?: stringinfoButtonUrl?: stringonClickCta?: () => void+ loading?: booleandisabled?: booleandisabledMessage?: string}@@ -21,6 +22,7 @@ const ProductEmptyState = ({infoButtonLabel = '',infoButtonUrl = '',onClickCta = () => {},+ loading = false,disabled = false,disabledMessage = '',}: PropsWithChildren<ProductEmptyStateProps>) => {@@ -39,7 +41,12 @@ const ProductEmptyState = ({{ctaButtonLabel && onClickCta && (<Tooltip.Root delayDuration={0}><Tooltip.Trigger asChild>- <Button type="primary" onClick={onClickCta} disabled={disabled}>+ <Button+ type="primary"+ onClick={onClickCta}+ loading={loading}+ disabled={loading || disabled}+ >{ctaButtonLabel}</Button></Tooltip.Trigger>diff --git a/studio/pages/project/[ref]/database/hooks/index.tsx b/studio/pages/project/[ref]/database/hooks/index.tsxindex 71f7f6bdf0d..86ccc236c4b 100644--- a/studio/pages/project/[ref]/database/hooks/index.tsx+++ b/studio/pages/project/[ref]/database/hooks/index.tsx@@ -30,7 +30,7 @@ const HooksPage: NextPageWithLayout = () => {const canReadWebhooks = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_READ, 'triggers')const canCreateWebhooks = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'triggers')- const { mutate: enableHooks } = useHooksEnableMutation({+ const { mutate: enableHooks, isLoading: isEnablingHooks } = useHooksEnableMutation({onSuccess: () => {meta.schemas.load()ui.setNotification({@@ -85,8 +85,11 @@ const HooksPage: NextPageWithLayout = () => {title="Database Webhooks"ctaButtonLabel="Enable webhooks"onClickCta={() => enableHooksForProject()}- disabled={!canCreateWebhooks}- disabledMessage="You need additional permissions to enable webhooks"+ loading={isEnablingHooks}+ disabled={isEnablingHooks || !canCreateWebhooks}+ disabledMessage={+ !canCreateWebhooks ? 'You need additional permissions to enable webhooks' : undefined+ }><p className="text-sm text-scale-1100">Database Webhooks can be used to trigger serverless functions or send requests to an