From 73c9110ed0e1feef78f372cd0e059ed672bda7b5 Mon Sep 17 00:00:00 2001 From: Terry Sutton Date: Tue, 7 Oct 2025 14:57:37 -0230 Subject: [PATCH] Check coming up status and show alert --- .../layouts/ProjectLayout/BuildingState.tsx | 71 ++++++++++++++++--- 1 file changed, 62 insertions(+), 9 deletions(-) diff --git a/apps/studio/components/layouts/ProjectLayout/BuildingState.tsx b/apps/studio/components/layouts/ProjectLayout/BuildingState.tsx index e41e23e2bc0..20519529694 100644 --- a/apps/studio/components/layouts/ProjectLayout/BuildingState.tsx +++ b/apps/studio/components/layouts/ProjectLayout/BuildingState.tsx @@ -1,5 +1,6 @@ import { useQueryClient } from '@tanstack/react-query' -import { ArrowRight, Loader2 } from 'lucide-react' +import dayjs from 'dayjs' +import { ArrowRight, Loader2, AlertCircle } from 'lucide-react' import Link from 'next/link' import { useParams } from 'common' @@ -14,7 +15,8 @@ import { useCustomContent } from 'hooks/custom-content/useCustomContent' import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { DOCS_URL, PROJECT_STATUS } from 'lib/constants' -import { Badge, Button } from 'ui' +import { Badge, Button, Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_ } from 'ui' +import { DynamicStatus } from './ProjectLoadingStatus' const BuildingState = () => { const { ref } = useParams() @@ -27,6 +29,14 @@ const BuildingState = () => { 'project_homepage:client_libraries', ]) + // Check if project startup is stalled (taking longer than 5 minutes) + // inserted_at is stored as UTC without timezone indicator, so we need to parse it as UTC + const minutesSinceInserted = project?.inserted_at + ? dayjs().diff(dayjs.utc(project.inserted_at), 'minute') + : 0 + const comingupStalled = + project?.status === PROJECT_STATUS.COMING_UP && project?.inserted_at && minutesSinceInserted > 5 + useProjectStatusQuery( { projectRef: ref }, { @@ -62,13 +72,56 @@ const BuildingState = () => { -
-

- {' '} - We are provisioning your database and API endpoints -

-

This may take a few minutes

-
+ {project.status === PROJECT_STATUS.COMING_UP ? ( + <> + {comingupStalled ? ( + + + + This process is taking longer than expected. + + +

+

+ Please check our{' '} + + incident page + {' '} + for any ongoing issues, or{' '} + + Contact support + {' '} + if the issue persists. +

+
+
+ ) : ( +
+

+ We are provisioning your database and API endpoints +

+

This may take a few minutes

+
+ )} + + ) : ( +
+

+ We are provisioning your database and API endpoints +

+

This may take a few minutes

+
+ )}