Skip to content

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

Small refactor in Infrastructure componnet

Joshen Lim94b17ecac4ca
diff --git a/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx b/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx
index 52e13db0717..c473dba7c82 100644
--- a/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx
+++ b/studio/components/interfaces/Settings/General/Infrastructure/Infrastructure.tsx
@@ -1,10 +1,9 @@
import Link from 'next/link'
-import { FC } from 'react'
import { Alert, Badge, Button, IconPackage, Input } from 'ui'
import { observer } from 'mobx-react-lite'
import * as Tooltip from '@radix-ui/react-tooltip'
-import { useFlag, useStore } from 'hooks'
+import { useFlag } from 'hooks'
import { useParams } from 'common/hooks'
import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
import {
@@ -19,18 +18,19 @@ import PauseProjectButton from './PauseProjectButton'
import RestartServerButton from './RestartServerButton'
import { useProjectSubscriptionQuery } from 'data/subscriptions/project-subscription-query'
import { useProjectUpgradeEligibilityQuery } from 'data/config/project-upgrade-eligibility-query'
+import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
-interface Props {}
+interface InfrastructureProps {}
-const Infrastructure: FC<Props> = ({}) => {
- const { ui } = useStore()
+const Infrastructure = ({}: InfrastructureProps) => {
const { ref } = useParams()
-
- const project = ui.selectedProject
+ const { project } = useProjectContext()
const { data: subscription } = useProjectSubscriptionQuery({ projectRef: ref })
const isFreeProject = subscription?.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.FREE
- const { data, isLoading } = useProjectUpgradeEligibilityQuery({ projectRef: ref })
+ const { data, isLoading: isLoadingUpgradeElibility } = useProjectUpgradeEligibilityQuery({
+ projectRef: ref,
+ })
const { current_app_version, latest_app_version, requires_manual_intervention } = data || {}
const isOnLatestVersion = current_app_version === latest_app_version
const currentPgVersion = (current_app_version ?? '').split('supabase-postgres-')[1]
@@ -87,7 +87,7 @@ const Infrastructure: FC<Props> = ({}) => {
</FormSection>
<FormSection header={<FormSectionLabel>Postgres</FormSectionLabel>}>
- <FormSectionContent loading={isLoading}>
+ <FormSectionContent loading={isLoadingUpgradeElibility}>
<Input
readOnly
disabled