Skip to content

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

Fix project cards not showing paused state

Joshen Lim7a1679f00dbe
diff --git a/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx b/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx
index 5c53d43afaf..4fa086a68a1 100644
--- a/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx
+++ b/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx
@@ -69,12 +69,7 @@ const ProjectCard = ({
}
footer={
<div className="mb-[-26px]">
- {resourceWarnings && (
- <ProjectCardStatus
- projectStatus={projectStatus}
- resourceWarnings={resourceWarnings}
- />
- )}
+ <ProjectCardStatus projectStatus={projectStatus} resourceWarnings={resourceWarnings} />
</div>
}
></CardButton>
diff --git a/studio/components/interfaces/Home/ProjectList/ProjectCardStatus.tsx b/studio/components/interfaces/Home/ProjectList/ProjectCardStatus.tsx
index bc889b3c721..1eb4b6758aa 100644
--- a/studio/components/interfaces/Home/ProjectList/ProjectCardStatus.tsx
+++ b/studio/components/interfaces/Home/ProjectList/ProjectCardStatus.tsx
@@ -5,7 +5,6 @@ import {
AlertDescription_Shadcn_,
AlertTitle_Shadcn_,
IconAlertTriangle,
- IconLoader,
IconPauseCircle,
IconRefreshCw,
} from 'ui'
@@ -13,7 +12,7 @@ import { InferredProjectStatus } from './ProjectCard.utils'
import { getWarningContent } from 'components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.utils'
export interface ProjectCardWarningsProps {
- resourceWarnings: ResourceWarning
+ resourceWarnings?: ResourceWarning
projectStatus: InferredProjectStatus
}
@@ -25,17 +24,17 @@ export const ProjectCardStatus = ({
const showResourceExhaustionWarnings = false
// [Joshen] Read only takes higher precedence over multiple resource warnings
- const activeWarnings = resourceWarnings.is_readonly_mode_enabled
+ const activeWarnings = resourceWarnings?.is_readonly_mode_enabled
? ['is_readonly_mode_enabled']
- : Object.keys(resourceWarnings).filter(
+ : Object.keys(resourceWarnings || {}).filter(
(property) =>
property !== 'project' &&
property !== 'is_readonly_mode_enabled' &&
- resourceWarnings[property as keyof typeof resourceWarnings] !== null
+ resourceWarnings?.[property as keyof typeof resourceWarnings] !== null
)
const hasCriticalWarning = activeWarnings.some(
- (x) => resourceWarnings[x as keyof typeof resourceWarnings] === 'critical'
+ (x) => resourceWarnings?.[x as keyof typeof resourceWarnings] === 'critical'
)
const isCritical = activeWarnings.includes('is_readonly_mode_enabled') || hasCriticalWarning
@@ -45,6 +44,8 @@ export const ProjectCardStatus = ({
if (projectStatus === 'isComingUp') return 'Project is coming up'
if (projectStatus === 'isRestoring') return 'Project is restoring'
+ if (!resourceWarnings) return undefined
+
// If none of the paused/restoring states match, proceed with the default logic
return activeWarnings.length > 1
? RESOURCE_WARNING_MESSAGES.multiple_resource_warnings.cardContent[
@@ -59,6 +60,8 @@ export const ProjectCardStatus = ({
if (projectStatus === 'isComingUp') return 'Your project will be ready in a few minutes'
if (projectStatus === 'isRestoring') return 'Your project will be ready in a few minutes'
+ if (!resourceWarnings) return undefined
+
// If none of the paused/restoring states match, proceed with the default logic
return activeWarnings.length > 1 && showResourceExhaustionWarnings
? RESOURCE_WARNING_MESSAGES.multiple_resource_warnings.cardContent[