Skip to content

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

studio: improve warning for replicas on spend cap (#51179)

Charis01bfab39d698
diff --git a/apps/studio/components/interfaces/Organization/Usage/UsageSection/DiskUsage.tsx b/apps/studio/components/interfaces/Organization/Usage/UsageSection/DiskUsage.tsx
index a71d808b389..ea445225e8b 100644
--- a/apps/studio/components/interfaces/Organization/Usage/UsageSection/DiskUsage.tsx
+++ b/apps/studio/components/interfaces/Organization/Usage/UsageSection/DiskUsage.tsx
@@ -62,11 +62,14 @@ export const DiskUsage = ({
: []
}, [isSuccess, projects, projectRef])
+ const hasReplicas = useMemo(
+ () => relevantProjects.some((it) => it.databases.some((db) => db.type === 'READ_REPLICA')),
+ [relevantProjects]
+ )
+
const hasProjectsExceedingDiskSize = useMemo(() => {
return relevantProjects.some((it) =>
- it.databases.some(
- (db) => db.type === 'READ_REPLICA' || (db.disk_volume_size_gb && db.disk_volume_size_gb > 8)
- )
+ it.databases.some((db) => db.disk_volume_size_gb && db.disk_volume_size_gb > 8)
)
}, [relevantProjects])
@@ -103,6 +106,21 @@ export const DiskUsage = ({
</AlertDescription>
</Alert>
)}
+ {currentBillingCycleSelected &&
+ subscription?.usage_billing_enabled === false &&
+ !hasProjectsExceedingDiskSize &&
+ hasReplicas && (
+ <Alert variant="warning">
+ <CriticalIcon />
+ <AlertTitle>
+ Read replicas add disk usage beyond your plan's included quota
+ </AlertTitle>
+ <AlertDescription>
+ You have read replicas in your projects, but do not allow any overages with the
+ Spend Cap on. Remove the read replicas or disable the spend cap.
+ </AlertDescription>
+ </Alert>
+ )}
<div>
<div className="flex items-center justify-between">