Skip to content

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

fix: re load project detail after building complete

phamhieu7711e5a9f5a2
diff --git a/studio/components/layouts/ProjectLayout/BuildingState.tsx b/studio/components/layouts/ProjectLayout/BuildingState.tsx
index d6ebac3fa95..34dc90d4eeb 100644
--- a/studio/components/layouts/ProjectLayout/BuildingState.tsx
+++ b/studio/components/layouts/ProjectLayout/BuildingState.tsx
@@ -8,7 +8,7 @@ import { CLIENT_LIBRARIES, EXAMPLE_PROJECTS } from 'components/interfaces/Home/H
import { API_URL, PROJECT_STATUS } from 'lib/constants'
import { useStore } from 'hooks'
-import { get, getWithTimeout } from 'lib/common/fetch'
+import { getWithTimeout } from 'lib/common/fetch'
import { Project } from 'types'
import { DisplayApiSettings, DisplayConfigSettings } from 'components/ui/ProjectSettings'
@@ -28,12 +28,14 @@ const ProjectBuildingState: FC<ProjectBuildingState> = ({ project }) => {
const { status } = projectStatus
if (status === PROJECT_STATUS.ACTIVE_HEALTHY) {
clearInterval(checkServerInterval.current)
+ // re-fetch project detail
+ await app.projects.fetchDetail(project.ref)
- const res = await get(`${API_URL}/props/project/${project.ref}/connection-string`)
- if (res && res.connectionString) {
- app.onProjectConnectionStringUpdated(project.id, res.connectionString)
- }
- app.onProjectStatusUpdated(project.id, status)
+ // const res = await get(`${API_URL}/props/project/${project.ref}/connection-string`)
+ // if (res && res.connectionString) {
+ // app.onProjectConnectionStringUpdated(project.id, res.connectionString)
+ // }
+ // app.onProjectStatusUpdated(project.id, status)
}
}
}
diff --git a/studio/stores/app/ProjectStore.ts b/studio/stores/app/ProjectStore.ts
index 410d6f2199d..b1f7234a0dd 100644
--- a/studio/stores/app/ProjectStore.ts
+++ b/studio/stores/app/ProjectStore.ts
@@ -9,7 +9,7 @@ import PostgresMetaInterface, { IPostgresMetaInterface } from '../common/Postgre
import pingPostgrest from 'lib/pingPostgrest'
export interface IProjectStore extends IPostgresMetaInterface<Project> {
- fetchDetail: (projectRef: string) => void
+ fetchDetail: (projectRef: string) => Promise<void>
}
export default class ProjectStore extends PostgresMetaInterface<Project> {
@@ -57,22 +57,21 @@ export default class ProjectStore extends PostgresMetaInterface<Project> {
async fetchSubscriptionTier(project: Project) {
const { id: projectId, ref: projectRef, status } = project
- // if project.status is not ACTIVE_HEALTHY, don't fetch subscription
- if (status !== PROJECT_STATUS.ACTIVE_HEALTHY) return
-
- const url = `${this.url}/${projectRef}/subscription`
- const headers = constructHeaders(this.headers)
- const response = await get(url, { headers })
- if (!response.error) {
- const subscriptionInfo = response as {
- tier: {
- supabase_prod_id: string
+ if (status === PROJECT_STATUS.ACTIVE_HEALTHY) {
+ const url = `${this.url}/${projectRef}/subscription`
+ const headers = constructHeaders(this.headers)
+ const response = await get(url, { headers })
+ if (!response.error) {
+ const subscriptionInfo = response as {
+ tier: {
+ supabase_prod_id: string
+ }
}
+ // update subscription_tier key
+ const clone = cloneDeep(this.data[projectId])
+ clone.subscription_tier = subscriptionInfo.tier.supabase_prod_id
+ this.data[projectId] = clone
}
- // update subscription_tier key
- const clone = cloneDeep(this.data[projectId])
- clone.subscription_tier = subscriptionInfo.tier.supabase_prod_id
- this.data[projectId] = clone
}
}
}