The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix consistency of pause state across pages and prevent subscription changes if project is not active
Joshen Lim798a46a19431
diff --git a/studio/components/grid/SupabaseGrid.tsx b/studio/components/grid/SupabaseGrid.tsxindex 299501c1073..94e65bfa996 100644--- a/studio/components/grid/SupabaseGrid.tsx+++ b/studio/components/grid/SupabaseGrid.tsx@@ -168,7 +168,6 @@ const SupabaseGridLayout = forwardRef<SupabaseGridRef, SupabaseGridProps>((propsfilter as string[])- console.log('savedState:', savedState)if (savedState.sorts || savedState.filters) {setParams((prevParams) => {return {diff --git a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx b/studio/components/interfaces/Billing/EnterpriseUpdate.tsxindex 3e3ec309bfd..d6a7fd01e16 100644--- a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx+++ b/studio/components/interfaces/Billing/EnterpriseUpdate.tsx@@ -272,7 +272,7 @@ const EnterpriseUpdate: FC<Props> = ({</div></div></div>- <div className="w-[34rem]">+ <div className="min-w-[440px]"><PaymentSummaryPanelisSpendCapEnabled={true}isSubmitting={isSubmitting}diff --git a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsxindex bcdd0c7a1a9..103c87437a7 100644--- a/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx+++ b/studio/components/interfaces/Billing/PaymentSummaryPanel/PaymentSummaryPanel.tsx@@ -4,7 +4,12 @@ import { Listbox, IconLoader, Button, IconPlus, IconAlertCircle, IconCreditCardimport { PermissionAction } from '@supabase/shared-types/out/constants'import { checkPermissions, useStore } from 'hooks'-import { BASE_PATH, PRICING_TIER_PRODUCT_IDS, STRIPE_PRODUCT_IDS } from 'lib/constants'+import {+ BASE_PATH,+ PRICING_TIER_PRODUCT_IDS,+ PROJECT_STATUS,+ STRIPE_PRODUCT_IDS,+} from 'lib/constants'import { SubscriptionPreview } from '../Billing.types'import { getProductPrice, validateSubscriptionUpdatePayload } from '../Billing.utils'import PaymentTotal from './PaymentTotal'@@ -79,6 +84,7 @@ const PaymentSummaryPanel: FC<Props> = ({captcha,}) => {const { ui } = useStore()+ const isActive = ui.selectedProject?.status === PROJECT_STATUS.ACTIVE_HEALTHYconst projectRegion = ui.selectedProject?.region// [Joshen] Point of refactor: Current plan can just be currentSubscription.tier@@ -444,6 +450,7 @@ const PaymentSummaryPanel: FC<Props> = ({size="medium"loading={isSubmitting}disabled={+ !isActive ||isSubmitting ||isLoadingPaymentMethods ||!hasChangesToPlan ||@@ -454,7 +461,7 @@ const PaymentSummaryPanel: FC<Props> = ({Confirm payment</Button></Tooltip.Trigger>- {!hasChangesToPlan ? (+ {!hasChangesToPlan || !selectedPaymentMethod || !isActive ? (<Tooltip.Portal><Tooltip.Content side="bottom"><Tooltip.Arrow className="radix-tooltip-arrow" />@@ -465,28 +472,18 @@ const PaymentSummaryPanel: FC<Props> = ({].join(' ')}><span className="text-xs text-scale-1200">- No changes made to your subscription+ {!hasChangesToPlan+ ? 'No changes made to your subscription'+ : !selectedPaymentMethod+ ? 'Please select a payment method'+ : !isActive+ ? 'Unable to update subscription as project is not active'+ : ''}</span></div></Tooltip.Content></Tooltip.Portal>- ) : !selectedPaymentMethod ? (- <Tooltip.Portal>- <Tooltip.Content side="bottom">- <Tooltip.Arrow className="radix-tooltip-arrow" />- <div- className={[- 'rounded bg-scale-100 py-1 px-2 leading-none shadow',- 'border border-scale-200',- ].join(' ')}- >- <span className="text-xs text-scale-1200">Please select a payment method</span>- </div>- </Tooltip.Content>- </Tooltip.Portal>- ) : (- <></>- )}+ ) : null}</Tooltip.Root></div></div>diff --git a/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx b/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsxindex 316265f8e2b..5b8eb7d8293 100644--- a/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx+++ b/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCTAButton.tsx@@ -2,8 +2,8 @@ import { FC } from 'react'import { Button, IconLoader } from 'ui'import * as Tooltip from '@radix-ui/react-tooltip'-import { useFlag } from 'hooks'-import { STRIPE_PRODUCT_IDS } from 'lib/constants'+import { useFlag, useStore } from 'hooks'+import { PROJECT_STATUS, STRIPE_PRODUCT_IDS } from 'lib/constants'import { StripeProduct } from 'components/interfaces/Billing'import Link from 'next/link'@@ -14,6 +14,8 @@ interface Props {}const PlanCTAButton: FC<Props> = ({ plan, currentPlan, onSelectPlan }) => {+ const { ui } = useStore()+ const isActive = ui.selectedProject?.status === PROJECT_STATUS.ACTIVE_HEALTHYconst projectUpdateDisabled = useFlag('disableProjectCreationAndUpdate')const getButtonType = (plan: any, currentPlan: any) => {@@ -84,7 +86,8 @@ const PlanCTAButton: FC<Props> = ({ plan, currentPlan, onSelectPlan }) => {const type = getButtonType(plan, currentPlan)const ctaText = getButtonText(plan, currentPlan)const disabled =- plan.id === STRIPE_PRODUCT_IDS.FREE && currentPlan.prod_id === STRIPE_PRODUCT_IDS.FREE+ (!isActive && plan.name !== 'Enterprise') ||+ (plan.id === STRIPE_PRODUCT_IDS.FREE && currentPlan.prod_id === STRIPE_PRODUCT_IDS.FREE)if (plan.name === 'Enterprise') {return (@@ -111,7 +114,7 @@ const PlanCTAButton: FC<Props> = ({ plan, currentPlan, onSelectPlan }) => {{ctaText}</Button></Tooltip.Trigger>- {!disabled && projectUpdateDisabled && (+ {(projectUpdateDisabled || !isActive) && (<Tooltip.Portal><Tooltip.Portal><Tooltip.Content side="bottom">@@ -123,7 +126,11 @@ const PlanCTAButton: FC<Props> = ({ plan, currentPlan, onSelectPlan }) => {].join(' ')}><span className="text-xs text-scale-1200 text-center">- Subscription changes are currently disabled, our engineers are working on a fix+ {projectUpdateDisabled+ ? 'Subscription changes are currently disabled, our engineers are working on a fix'+ : !isActive+ ? 'Unable to update subscription as project is not active'+ : ''}</span></div></Tooltip.Content>diff --git a/studio/components/interfaces/Billing/ProUpgrade.tsx b/studio/components/interfaces/Billing/ProUpgrade.tsxindex 5c4e8596d15..fac2c6db074 100644--- a/studio/components/interfaces/Billing/ProUpgrade.tsx+++ b/studio/components/interfaces/Billing/ProUpgrade.tsx@@ -321,7 +321,7 @@ const ProUpgrade: FC<Props> = ({</div></div></div>- <div className="w-[34rem]">+ <div className="min-w-[440px]"><PaymentSummaryPanelisRefreshingPreview={isRefreshingPreview}subscriptionPreview={subscriptionPreview}diff --git a/studio/components/interfaces/Billing/Subscription/Subscription.tsx b/studio/components/interfaces/Billing/Subscription/Subscription.tsxindex 2203e92885c..905a3b39561 100644--- a/studio/components/interfaces/Billing/Subscription/Subscription.tsx+++ b/studio/components/interfaces/Billing/Subscription/Subscription.tsx@@ -1,43 +1,32 @@import dayjs from 'dayjs'-import { FC } from 'react'+import { FC, useEffect } from 'react'import { useRouter } from 'next/router'import { Button, Loading } from 'ui'import * as Tooltip from '@radix-ui/react-tooltip'import { PermissionAction } from '@supabase/shared-types/out/constants'-import { checkPermissions, useFlag } from 'hooks'+import { checkPermissions, useFlag, useStore } from 'hooks'import { useParams } from 'common/hooks'-import { STRIPE_PRODUCT_IDS } from 'lib/constants'+import { PROJECT_STATUS, STRIPE_PRODUCT_IDS } from 'lib/constants'import { formatBytes } from 'lib/helpers'import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants'import CostBreakdownRow from './CostBreakdownRow'-import { StripeSubscription } from './Subscription.types'import NoPermission from 'components/ui/NoPermission'import { USAGE_BASED_PRODUCTS } from 'components/interfaces/Billing/Billing.constants'import { ProjectUsageResponseUsageKeys, useProjectUsageQuery } from 'data/usage/project-usage-query'+import { useProjectSubscriptionQuery } from 'data/subscriptions/project-subscription-query'interface Props {- project: any- subscription: StripeSubscription- loading?: booleanshowProjectName?: boolean- currentPeriodStart: number- currentPeriodEnd: number}-const Subscription: FC<Props> = ({- project,- subscription,- loading = false,- showProjectName = false,- currentPeriodStart,- currentPeriodEnd,-}) => {+const Subscription: FC<Props> = ({ showProjectName = false }) => {const router = useRouter()-+ const { ui } = useStore()const { ref: projectRef } = useParams()const projectUpdateDisabled = useFlag('disableProjectCreationAndUpdate')+ const isActive = ui.selectedProject?.status === PROJECT_STATUS.ACTIVE_HEALTHYconst canReadSubscription = checkPermissions(PermissionAction.READ, 'subscriptions')const canUpdateSubscription = checkPermissions(@@ -45,14 +34,23 @@ const Subscription: FC<Props> = ({'stripe.subscriptions')+ const project = ui.selectedProject+ const {+ data: subscription,+ isLoading: loading,+ error,+ } = useProjectSubscriptionQuery({ projectRef: ui.selectedProject?.ref })const { data: usage, isLoading: loadingUsage } = useProjectUsageQuery({ projectRef })const isPayg = subscription?.tier.prod_id === STRIPE_PRODUCT_IDS.PAYG- const isEnterprise = subscription.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.ENTERPRISE+ const isEnterprise = subscription?.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.ENTERPRISEconst addOns = subscription?.addons ?? []const paid = subscription && subscription.tier.unit_amount > 0- const basePlanCost = subscription?.tier.unit_amount / 100+ const basePlanCost = (subscription?.tier.unit_amount ?? 0) / 100++ const currentPeriodStart = subscription?.billing.current_period_start ?? 0+ const currentPeriodEnd = subscription?.billing.current_period_end ?? 0const deriveTotalCost = (): number => {const totalAddOnCost = addOns@@ -70,14 +68,23 @@ const Subscription: FC<Props> = ({return basePlanCost + totalAddOnCost + totalUsageCost}+ useEffect(() => {+ if (error) {+ ui.setNotification({+ category: 'error',+ message: `Failed to get project subscription: ${(error as any)?.message ?? 'unknown'}`,+ })+ }+ }, [error])+return (- <Loading active={loading || loadingUsage}>+ <Loading active={loading}><div className="w-full mb-8 overflow-hidden border rounded border-panel-border-light dark:border-panel-border-dark"><div className="bg-panel-body-light dark:bg-panel-body-dark"><div className="flex items-center justify-between px-6 pt-4"><div className="flex flex-col"><p className="text-sm text-scale-1100">- {showProjectName ? project.name : 'Current subscription'}+ {showProjectName ? project?.name ?? '' : 'Current subscription'}</p><h3 className="mb-0 text-xl">{subscription?.tier.name ?? '-'}</h3></div>@@ -85,11 +92,11 @@ const Subscription: FC<Props> = ({<Tooltip.Root delayDuration={0}><Tooltip.Trigger><Button- disabled={!canUpdateSubscription || projectUpdateDisabled}+ disabled={!canUpdateSubscription || projectUpdateDisabled || !isActive}onClick={() => {const url = isEnterprise- ? `/project/${project.ref}/settings/billing/update/enterprise`- : `/project/${project.ref}/settings/billing/update`+ ? `/project/${projectRef}/settings/billing/update/enterprise`+ : `/project/${projectRef}/settings/billing/update`router.push(url)}}type="primary"@@ -97,7 +104,7 @@ const Subscription: FC<Props> = ({{isEnterprise ? 'Change add-ons' : 'Change subscription'}</Button></Tooltip.Trigger>- {!canUpdateSubscription || projectUpdateDisabled ? (+ {!canUpdateSubscription || projectUpdateDisabled || !isActive ? (<Tooltip.Portal><Tooltip.Content side="bottom"><Tooltip.Arrow className="radix-tooltip-arrow" />@@ -116,6 +123,8 @@ const Subscription: FC<Props> = ({</>) : !canUpdateSubscription ? ('You need additional permissions to amend subscriptions'+ ) : !isActive ? (+ 'Unable to update subscription as project is not active') : ('')}diff --git a/studio/components/interfaces/Billing/TeamUpgrade.tsx b/studio/components/interfaces/Billing/TeamUpgrade.tsxindex e067a403a06..55fbb9c3bee 100644--- a/studio/components/interfaces/Billing/TeamUpgrade.tsx+++ b/studio/components/interfaces/Billing/TeamUpgrade.tsx@@ -291,7 +291,7 @@ const TeamUpgrade: FC<Props> = ({</div></div></div>- <div className="w-[34rem]">+ <div className="min-w-[440px]"><PaymentSummaryPanelisRefreshingPreview={isRefreshingPreview}subscriptionPreview={subscriptionPreview}diff --git a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsxindex c4909d2264e..8d158b7ecfd 100644--- a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx+++ b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx@@ -236,7 +236,7 @@ const TableGridEditor = ({{table: selectedTable as PostgresTable,columns: (selectedTable as PostgresTable).columns ?? [],- primaryKeys: (selectedTable as PostgresTable).primary_keys,+ primaryKeys: (selectedTable as PostgresTable).primary_keys ?? [],relationships: formattedRelationships,},encryptedColumnsdiff --git a/studio/components/layouts/AuthLayout/AuthLayout.tsx b/studio/components/layouts/AuthLayout/AuthLayout.tsxindex f747c9adf22..8acef13d526 100644--- a/studio/components/layouts/AuthLayout/AuthLayout.tsx+++ b/studio/components/layouts/AuthLayout/AuthLayout.tsx@@ -2,8 +2,8 @@ import { FC, ReactNode, useState, useEffect } from 'react'import { observer } from 'mobx-react-lite'import { useRouter } from 'next/router'+import ProjectLayout from '../'import { useStore, withAuth } from 'hooks'-import BaseLayout from '../'import Error from 'components/ui/Error'import ProductMenu from 'components/ui/ProductMenu'import { generateAuthMenu } from './AuthLayout.utils'@@ -40,14 +40,14 @@ const AuthLayout: FC<Props> = ({ title, children }) => {if (error) {return (- <BaseLayout>+ <ProjectLayout><Error error={error} />- </BaseLayout>+ </ProjectLayout>)}return (- <BaseLayout+ <ProjectLayoutisLoading={!loaded}title={title || 'Authentication'}product="Authentication"@@ -56,7 +56,7 @@ const AuthLayout: FC<Props> = ({ title, children }) => {<main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto">{children}</main>- </BaseLayout>+ </ProjectLayout>)}diff --git a/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx b/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsxindex 5b45d0b9064..e162c8ed05c 100644--- a/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx+++ b/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx@@ -2,8 +2,8 @@ import { FC, ReactNode, useEffect, useState } from 'react'import { observer } from 'mobx-react-lite'import { useRouter } from 'next/router'+import ProjectLayout from '../'import { useStore, withAuth } from 'hooks'-import BaseLayout from '../'import Error from 'components/ui/Error'import ProductMenu from 'components/ui/ProductMenu'import { generateDatabaseMenu } from './DatabaseMenu.utils'@@ -61,14 +61,14 @@ const DatabaseLayout: FC<Props> = ({ title, children }) => {if (error) {return (- <BaseLayout>+ <ProjectLayout><Error error={error} />- </BaseLayout>+ </ProjectLayout>)}return (- <BaseLayout+ <ProjectLayoutisLoading={!loaded}product="Database"productMenu={<ProductMenu page={page} menu={generateDatabaseMenu(project)} />}@@ -76,7 +76,7 @@ const DatabaseLayout: FC<Props> = ({ title, children }) => {<main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto">{children}</main>- </BaseLayout>+ </ProjectLayout>)}diff --git a/studio/components/layouts/DocsLayout/DocsLayout.tsx b/studio/components/layouts/DocsLayout/DocsLayout.tsxindex f4d677f2669..a4923f56077 100644--- a/studio/components/layouts/DocsLayout/DocsLayout.tsx+++ b/studio/components/layouts/DocsLayout/DocsLayout.tsx@@ -2,17 +2,20 @@ import { ReactElement, useEffect } from 'react'import { observer } from 'mobx-react-lite'import { useRouter } from 'next/router'+import ProjectLayout from '../'import { useStore, withAuth } from 'hooks'import Error from 'components/ui/Error'import ProductMenu from 'components/ui/ProductMenu'-import ProjectLayout from 'components/layouts/ProjectLayout/ProjectLayout'import { generateDocsMenu } from './DocsLayout.utils'+import { PROJECT_STATUS } from 'lib/constants'function DocsLayout({ title, children }: { title: string; children: ReactElement }) {const router = useRouter()const { meta, ui } = useStore()const { data, isLoading, error } = meta.openApi+ const isPaused = ui.selectedProject?.status === PROJECT_STATUS.INACTIVE+const getPage = () => {if (router.pathname.endsWith('graphiql')) return 'graphiql'@@ -22,14 +25,14 @@ function DocsLayout({ title, children }: { title: string; children: ReactElement}useEffect(() => {- if (ui.selectedProject?.ref) {+ if (ui.selectedProject?.ref && !isPaused) {meta.openApi.load()}}, [ui.selectedProject?.ref])if (error) {return (- <ProjectLayout>+ <ProjectLayout product="API Docs"><Error error={error} /></ProjectLayout>)diff --git a/studio/components/layouts/FunctionsLayout.tsx b/studio/components/layouts/FunctionsLayout.tsxindex c7271b1d877..f8caaf4780a 100644--- a/studio/components/layouts/FunctionsLayout.tsx+++ b/studio/components/layouts/FunctionsLayout.tsx@@ -3,10 +3,10 @@ import { FC, ReactNode, useState } from 'react'import { observer } from 'mobx-react-lite'import { Button, IconExternalLink, IconCode, Modal, IconTerminal } from 'ui'+import ProjectLayout from './'import { checkPermissions, withAuth } from 'hooks'import { useParams } from 'common/hooks'import FunctionsNav from '../interfaces/Functions/FunctionsNav'-import BaseLayout from 'components/layouts'import NoPermission from 'components/ui/NoPermission'import { PermissionAction } from '@supabase/shared-types/out/constants'import { TerminalInstructions } from 'components/interfaces/Functions'@@ -27,11 +27,11 @@ const FunctionsLayout: FC<Props> = ({ title, children }) => {const canReadFunctions = checkPermissions(PermissionAction.FUNCTIONS_READ, '*')if (!canReadFunctions) {return (- <BaseLayout title={title || 'Edge Functions'} product="Edge Functions">+ <ProjectLayout title={title || 'Edge Functions'} product="Edge Functions"><main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto"><NoPermission isFullPage resourceText="access your project's edge functions" /></main>- </BaseLayout>+ </ProjectLayout>)}@@ -40,7 +40,7 @@ const FunctionsLayout: FC<Props> = ({ title, children }) => {const centered = !hasFunctionsreturn (- <BaseLayout isLoading={isLoading} title={title || 'Edge Functions'} product="Edge Functions">+ <ProjectLayout isLoading={isLoading} title={title || 'Edge Functions'} product="Edge Functions">{centered ? (<><div className="mx-auto max-w-5xl py-24 px-5">@@ -171,7 +171,7 @@ const FunctionsLayout: FC<Props> = ({ title, children }) => {<TerminalInstructions removeBorder /></div></Modal>- </BaseLayout>+ </ProjectLayout>)}diff --git a/studio/components/layouts/LogsLayout/LogsLayout.tsx b/studio/components/layouts/LogsLayout/LogsLayout.tsxindex 2a8c7c8e116..1d889b1735f 100644--- a/studio/components/layouts/LogsLayout/LogsLayout.tsx+++ b/studio/components/layouts/LogsLayout/LogsLayout.tsx@@ -3,7 +3,7 @@ import { observer } from 'mobx-react-lite'import { PermissionAction } from '@supabase/shared-types/out/constants'import { useRouter } from 'next/router'import { checkPermissions, useStore, withAuth } from 'hooks'-import BaseLayout from 'components/layouts'+import ProjectLayout from '../'import NoPermission from 'components/ui/NoPermission'import { generateLogsMenu } from './LogsMenu.utils'import ProductMenu from 'components/ui/ProductMenu'@@ -24,16 +24,16 @@ const LogsLayout = ({ title, children }: PropsWithChildren<LogsLayoutProps>) =>if (!canUseLogsExplorer) {return (- <BaseLayout>+ <ProjectLayout><main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto"><NoPermission isFullPage resourceText="access your project's logs explorer" /></main>- </BaseLayout>+ </ProjectLayout>)}return (- <BaseLayout+ <ProjectLayouttitle={title}product="Logs"productMenu={<ProductMenu page={page} menu={generateLogsMenu(project)} />}@@ -41,7 +41,7 @@ const LogsLayout = ({ title, children }: PropsWithChildren<LogsLayoutProps>) =><main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto">{children}</main>- </BaseLayout>+ </ProjectLayout>)}diff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsxindex 783e7b4aeb9..314f5d16569 100644--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx@@ -17,9 +17,6 @@ import { SHOW_O11Y } from 'components/interfaces/Settings/Logs'export const generateToolRoutes = (ref?: string, project?: ProjectBase): Route[] => {const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP- const isProjectPaused = project?.status === PROJECT_STATUS.INACTIVE-- const homeUrl = `/project/${ref}`const buildingUrl = `/project/${ref}/building`return [@@ -33,9 +30,7 @@ export const generateToolRoutes = (ref?: string, project?: ProjectBase): Route[]preProcessor={(code) => code.replace(/svg/, 'svg class="m-auto text-color-inherit"')}/>),- link:- ref &&- (isProjectPaused ? homeUrl : isProjectBuilding ? buildingUrl : `/project/${ref}/editor`),+ link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/editor`),},{key: 'sql',@@ -47,17 +42,12 @@ export const generateToolRoutes = (ref?: string, project?: ProjectBase): Route[]preProcessor={(code) => code.replace(/svg/, 'svg class="m-auto text-color-inherit"')}/>),- link:- ref &&- (isProjectPaused ? homeUrl : isProjectBuilding ? buildingUrl : `/project/${ref}/sql`),+ link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/sql`),},]}export const generateProductRoutes = (ref?: string, project?: ProjectBase): Route[] => {- const isProjectBuilding = project?.status !== PROJECT_STATUS.ACTIVE_HEALTHY- const isProjectPaused = project?.status === PROJECT_STATUS.INACTIVE-- const homeUrl = `/project/${ref}`+ const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UPconst buildingUrl = `/project/${ref}/building`return [@@ -65,37 +55,19 @@ export const generateProductRoutes = (ref?: string, project?: ProjectBase): Routkey: 'database',label: 'Database',icon: <IconDatabase size={18} strokeWidth={2} />,- link:- ref &&- (isProjectPaused- ? homeUrl- : isProjectBuilding- ? buildingUrl- : `/project/${ref}/database/tables`),+ link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/database/tables`),},{key: 'auth',label: 'Authentication',icon: <IconUsers size={18} strokeWidth={2} />,- link:- ref &&- (isProjectPaused- ? homeUrl- : isProjectBuilding- ? buildingUrl- : `/project/${ref}/auth/users`),+ link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/auth/users`),},{key: 'storage',label: 'Storage',icon: <IconArchive size={18} strokeWidth={2} />,- link:- ref &&- (isProjectPaused- ? homeUrl- : isProjectBuilding- ? buildingUrl- : `/project/${ref}/storage/buckets`),+ link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/storage/buckets`),},...(IS_PLATFORM? [@@ -103,13 +75,7 @@ export const generateProductRoutes = (ref?: string, project?: ProjectBase): Routkey: 'functions',label: 'Edge Functions',icon: <IconCode size={18} strokeWidth={2} />,- link:- ref &&- (isProjectPaused- ? homeUrl- : isProjectBuilding- ? buildingUrl- : `/project/${ref}/functions`),+ link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/functions`),},]: []),@@ -118,9 +84,6 @@ export const generateProductRoutes = (ref?: string, project?: ProjectBase): Routexport const generateOtherRoutes = (ref?: string, project?: ProjectBase): Route[] => {const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP- const isProjectPaused = project?.status === PROJECT_STATUS.INACTIVE-- const homeUrl = `/project/${ref}`const buildingUrl = `/project/${ref}/building`return [@@ -130,13 +93,7 @@ export const generateOtherRoutes = (ref?: string, project?: ProjectBase): Route[key: 'reports',label: 'Reports',icon: <IconBarChart size={18} strokeWidth={2} />,- link:- ref &&- (isProjectPaused- ? homeUrl- : isProjectBuilding- ? buildingUrl- : `/project/${ref}/reports`),+ link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/reports`),},]: []),@@ -146,13 +103,7 @@ export const generateOtherRoutes = (ref?: string, project?: ProjectBase): Route[key: 'logs',label: 'Logs',icon: <IconList size={18} strokeWidth={2} />,- link:- ref &&- (isProjectPaused- ? homeUrl- : isProjectBuilding- ? buildingUrl- : `/project/${ref}/logs/explorer`),+ link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/logs/explorer`),},]: []),@@ -160,9 +111,7 @@ export const generateOtherRoutes = (ref?: string, project?: ProjectBase): Route[key: 'api',label: 'API Docs',icon: <IconFileText size={18} strokeWidth={2} />,- link:- ref &&- (isProjectPaused ? homeUrl : isProjectBuilding ? buildingUrl : `/project/${ref}/api`),+ link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/api`),},...(IS_PLATFORM? [diff --git a/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/studio/components/layouts/ProjectLayout/ProjectLayout.tsxindex ee40f5c4d7b..4d49810b970 100644--- a/studio/components/layouts/ProjectLayout/ProjectLayout.tsx+++ b/studio/components/layouts/ProjectLayout/ProjectLayout.tsx@@ -1,5 +1,5 @@import Head from 'next/head'-import { FC, ReactNode, PropsWithChildren, Fragment } from 'react'+import { ReactNode, Fragment } from 'react'import { observer } from 'mobx-react-lite'import { useRouter } from 'next/router'import { useStore, withAuth, useFlag } from 'hooks'@@ -16,14 +16,16 @@ import BuildingState from './BuildingState'import { ProjectContextProvider } from './ProjectContext'import RestoringState from './RestoringState'import UpgradingState from './UpgradingState'+import ProjectPausedState from './ProjectPausedState'-interface Props {+export interface ProjectLayoutProps {title?: stringisLoading?: booleanproduct?: stringproductMenu?: ReactNodehideHeader?: booleanhideIconBar?: boolean+ children: ReactNode}const ProjectLayout = ({@@ -34,12 +36,18 @@ const ProjectLayout = ({children,hideHeader = false,hideIconBar = false,-}: PropsWithChildren<Props>) => {- const { ref: projectRef } = useParams()+}: ProjectLayoutProps) => {const { ui } = useStore()+ const router = useRouter()+ const { ref: projectRef } = useParams()const ongoingIncident = useFlag('ongoingIncident')const projectName = ui.selectedProject?.name+ const isPaused = ui.selectedProject?.status === PROJECT_STATUS.INACTIVE+ const ignorePausedState =+ router.pathname === '/project/[ref]' || router.pathname.includes('/project/[ref]/settings')+ const showPausedState = isPaused && !ignorePausedState+return (<ProjectContextProvider projectRef={projectRef}><Head>@@ -53,16 +61,26 @@ const ProjectLayout = ({{!hideIconBar && <NavigationBar />}{/* Product menu bar */}- <MenuBarWrapper isLoading={isLoading} productMenu={productMenu}>- <ProductMenuBar title={product}>{productMenu}</ProductMenuBar>- </MenuBarWrapper>+ {!showPausedState && (+ <MenuBarWrapper isLoading={isLoading} productMenu={productMenu}>+ <ProductMenuBar title={product}>{productMenu}</ProductMenuBar>+ </MenuBarWrapper>+ )}<mainclassName="flex flex-col flex-1 w-full overflow-x-hidden"style={{ height: ongoingIncident ? 'calc(100vh - 44px)' : '100vh' }}>{!hideHeader && <LayoutHeader />}- <ContentWrapper isLoading={isLoading}>{children}</ContentWrapper>+ {showPausedState ? (+ <div className="mx-auto my-16 w-full h-full max-w-7xl flex items-center">+ <div className="w-full">+ <ProjectPausedState product={product} />+ </div>+ </div>+ ) : (+ <ContentWrapper isLoading={isLoading}>{children}</ContentWrapper>+ )}</main></div></ProjectContextProvider>@@ -76,15 +94,17 @@ export default observer(ProjectLayout)interface MenuBarWrapperProps {isLoading: booleanproductMenu?: ReactNode+ children: ReactNode}-const MenuBarWrapper: FC<MenuBarWrapperProps> = observer(({ isLoading, productMenu, children }) => {+const MenuBarWrapper = observer(({ isLoading, productMenu, children }: MenuBarWrapperProps) => {const { ui } = useStore()return <>{!isLoading && productMenu && ui.selectedProject !== undefined ? children : null}</>})interface ContentWrapperProps {isLoading: boolean+ children: ReactNode}/**@@ -99,7 +119,7 @@ interface ContentWrapperProps {** [TODO] Next iteration should scrape long polling and just listen to the project's status*/-const ContentWrapper: FC<ContentWrapperProps> = observer(({ isLoading, children }) => {+const ContentWrapper = observer(({ isLoading, children }: ContentWrapperProps) => {const { ui } = useStore()const router = useRouter()@@ -143,6 +163,11 @@ const ContentWrapper: FC<ContentWrapperProps> = observer(({ isLoading, children)})+/**+ * Shows the children irregardless of whether the selected project has loaded or not+ * We'll eventually want to use this instead of the current ProjectLayout to prevent+ * a catch-all spinner on the dashboard+ */export const ProjectLayoutNonBlocking = ({title,product = '',@@ -150,9 +175,15 @@ export const ProjectLayoutNonBlocking = ({children,hideHeader = false,hideIconBar = false,-}: PropsWithChildren<Props>) => {+}: ProjectLayoutProps) => {+ const { ui } = useStore()+ const router = useRouter()const { ref: projectRef } = useParams()const ongoingIncident = useFlag('ongoingIncident')+ const isPaused = ui.selectedProject?.status === PROJECT_STATUS.INACTIVE+ const ignorePausedState =+ router.pathname === '/project/[ref]' || router.pathname.includes('/project/[ref]/settings')+ const showPausedState = isPaused && !ignorePausedStatereturn (<ProjectContextProvider projectRef={projectRef}>@@ -166,14 +197,24 @@ export const ProjectLayoutNonBlocking = ({{!hideIconBar && <NavigationBar />}{/* Product menu bar */}- {productMenu && <ProductMenuBar title={product}>{productMenu}</ProductMenuBar>}+ {productMenu && !showPausedState && (+ <ProductMenuBar title={product}>{productMenu}</ProductMenuBar>+ )}<mainclassName="flex w-full flex-1 flex-col overflow-x-hidden"style={{ height: ongoingIncident ? 'calc(100vh - 44px)' : '100vh' }}>{!hideHeader && <LayoutHeader />}- {children}+ {showPausedState ? (+ <div className="mx-auto my-16 w-full h-full max-w-7xl flex items-center">+ <div className="w-full">+ <ProjectPausedState product={product} />+ </div>+ </div>+ ) : (+ children+ )}</main></div></ProjectContextProvider>diff --git a/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx b/studio/components/layouts/ProjectLayout/ProjectPausedState.tsxindex 0733a2fbc81..f217de7b35e 100644--- a/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx+++ b/studio/components/layouts/ProjectLayout/ProjectPausedState.tsx@@ -1,22 +1,24 @@-import { FC, useState } from 'react'+import Link from 'next/link'+import { useState } from 'react'import * as Tooltip from '@radix-ui/react-tooltip'import { Modal, Button, IconPauseCircle } from 'ui'import { PermissionAction } from '@supabase/shared-types/out/constants'-import { Project } from 'types'import { checkPermissions, useStore, useFlag } from 'hooks'import { post } from 'lib/common/fetch'import { API_URL, PROJECT_STATUS } from 'lib/constants'-import { DeleteProjectButton } from 'components/interfaces/Settings/General'import ConfirmModal from 'components/ui/Dialogs/ConfirmDialog'import { useFreeProjectLimitCheckQuery } from 'data/organizations/free-project-limit-check-query'+import { useParams } from 'common'-interface Props {- project: Project+export interface ProjectPausedStateProps {+ product?: string}-const ProjectPausedState: FC<Props> = ({ project }) => {+const ProjectPausedState = ({ product }: ProjectPausedStateProps) => {const { ui, app } = useStore()+ const { ref } = useParams()+ const project = ui.selectedProjectconst orgSlug = ui.selectedOrganization?.slugconst kpsEnabled = useFlag('initWithKps')@@ -42,6 +44,14 @@ const ProjectPausedState: FC<Props> = ({ project }) => {}const onConfirmRestore = async () => {+ if (!project) {+ return ui.setNotification({+ error: 'Project is required',+ category: 'error',+ message: 'Unable to restore: project is required',+ })+ }+await post(`${API_URL}/projects/${project.ref}/restore`, { kps_enabled: kpsEnabled })app.onProjectUpdated({ ...project, status: PROJECT_STATUS.RESTORING })ui.setNotification({ category: 'success', message: 'Restoring project' })@@ -52,12 +62,28 @@ const ProjectPausedState: FC<Props> = ({ project }) => {<div className="space-y-4"><div className="w-full mx-auto mb-16 max-w-7xl"><div className="mx-6 flex h-[500px] items-center justify-center rounded border border-scale-400 bg-scale-300 p-8">- <div className="grid w-[420px] gap-4">+ <div className="grid w-[480px] gap-4"><div className="mx-auto flex max-w-[300px] items-center justify-center space-x-4 lg:space-x-8"><IconPauseCircle className="text-scale-1100" size={50} strokeWidth={1.5} /></div>- <p className="text-center">This project is paused.</p>+ <div className="space-y-1">+ <p className="text-center">+ The project "{project?.name ?? ''}" is currently paused.+ </p>+ <p className="text-sm text-scale-1100 text-center">+ All of your project's data is still intact, but your project is inaccessible while+ paused.{' '}+ {product !== undefined ? (+ <>+ Restore this project to access the{' '}+ <span className="text-brand-900">{product}</span> page+ </>+ ) : (+ 'Restore this project and get back to building the next big thing!'+ )}+ </p>+ </div><div className="flex items-center justify-center gap-4"><Tooltip.Root delayDuration={0}>@@ -89,12 +115,12 @@ const ProjectPausedState: FC<Props> = ({ project }) => {</Tooltip.Portal>)}</Tooltip.Root>- <DeleteProjectButton type="default" />+ <Link href={`/project/${ref}/settings/general`}>+ <a>+ <Button type="default">View project settings</Button>+ </a>+ </Link></div>-- <p className="mt-4 text-sm text-scale-1000">- Restore this project and get back to building the next big thing!- </p></div></div></div>diff --git a/studio/components/layouts/ReportsLayout/ReportsLayout.tsx b/studio/components/layouts/ReportsLayout/ReportsLayout.tsxindex 59facd25d12..6c789413f9e 100644--- a/studio/components/layouts/ReportsLayout/ReportsLayout.tsx+++ b/studio/components/layouts/ReportsLayout/ReportsLayout.tsx@@ -2,7 +2,7 @@ import { PropsWithChildren } from 'react'import { observer } from 'mobx-react-lite'import { useRouter } from 'next/router'import { useStore, withAuth } from 'hooks'-import ProjectLayout from '../ProjectLayout/ProjectLayout'+import ProjectLayout from '../'import ProductMenu from 'components/ui/ProductMenu'import { generateReportsMenu } from './ReportsMenu.utils'diff --git a/studio/components/layouts/SQLEditorLayout/SQLEditorLayout.tsx b/studio/components/layouts/SQLEditorLayout/SQLEditorLayout.tsxindex 2900812c16f..035773cf1ed 100644--- a/studio/components/layouts/SQLEditorLayout/SQLEditorLayout.tsx+++ b/studio/components/layouts/SQLEditorLayout/SQLEditorLayout.tsx@@ -1,6 +1,6 @@import { ReactNode, useMemo } from 'react'import { withAuth } from 'hooks'-import { ProjectLayoutNonBlocking } from '../ProjectLayout/ProjectLayout'+import { ProjectLayoutNonBlocking } from '../'import SQLEditorMenu from './SQLEditorMenu'export interface SQLEditorLayoutProps {diff --git a/studio/components/layouts/SettingsLayout/SettingsLayout.tsx b/studio/components/layouts/SettingsLayout/SettingsLayout.tsxindex d60013f47b0..068a84aa347 100644--- a/studio/components/layouts/SettingsLayout/SettingsLayout.tsx+++ b/studio/components/layouts/SettingsLayout/SettingsLayout.tsx@@ -4,7 +4,7 @@ import { useRouter } from 'next/router'import { useStore, withAuth } from 'hooks'import { generateSettingsMenu } from './SettingsMenu.utils'-import BaseLayout from '../'+import ProjectLayout from '../'import ProductMenu from 'components/ui/ProductMenu'interface Props {@@ -33,7 +33,7 @@ const SettingsLayout: FC<Props> = ({ title, children }) => {}, [ui.selectedProject?.ref])return (- <BaseLayout+ <ProjectLayouttitle={title || 'Settings'}product="Settings"productMenu={<ProductMenu page={page} menu={menuRoutes} />}@@ -41,7 +41,7 @@ const SettingsLayout: FC<Props> = ({ title, children }) => {<main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto">{children}</main>- </BaseLayout>+ </ProjectLayout>)}diff --git a/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts b/studio/components/layouts/SettingsLayout/SettingsMenu.utils.tsindex ddaed65b6cd..87d133a4b26 100644--- a/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts+++ b/studio/components/layouts/SettingsLayout/SettingsMenu.utils.ts@@ -5,8 +5,7 @@ import { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'export const generateSettingsMenu = (ref: string, project?: ProjectBase): ProductMenuGroup[] => {const isVaultEnabled = useFlag('vaultExtension')-- const isProjectBuilding = project?.status !== PROJECT_STATUS.ACTIVE_HEALTHY+ const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UPconst buildingUrl = `/project/${ref}/building`return [diff --git a/studio/components/layouts/StorageLayout/StorageLayout.tsx b/studio/components/layouts/StorageLayout/StorageLayout.tsxindex 91d6657eb7b..cc753c05347 100644--- a/studio/components/layouts/StorageLayout/StorageLayout.tsx+++ b/studio/components/layouts/StorageLayout/StorageLayout.tsx@@ -5,11 +5,12 @@ import { observer } from 'mobx-react-lite'import { useStore, withAuth } from 'hooks'import { useParams } from 'common/hooks'import { AutoApiService, useProjectApiQuery } from 'data/config/project-api-query'-import ProjectLayout from '../ProjectLayout/ProjectLayout'+import ProjectLayout from '../'import StorageMenu from './StorageMenu'import { useStorageStore } from 'localStores/storageExplorer/StorageExplorerStore'import { formatPoliciesForStorage } from 'components/to-be-cleaned/Storage/Storage.utils'import DeleteBucketModal from 'components/to-be-cleaned/Storage/DeleteBucketModal'+import { PROJECT_STATUS } from 'lib/constants'interface Props {title: string@@ -19,7 +20,6 @@ interface Props {const StorageLayout: FC<Props> = ({ title, children }) => {const { ui, meta } = useStore()const { ref: projectRef } = useParams()-const storageExplorerStore = useStorageStore()const {selectedBucketToEdit,@@ -32,11 +32,15 @@ const StorageLayout: FC<Props> = ({ title, children }) => {const { data: settings, isLoading } = useProjectApiQuery({ projectRef })const apiService = settings?.autoApiService+ const isPaused = ui.selectedProject?.status === PROJECT_STATUS.INACTIVE+useEffect(() => {if (!isLoading && apiService) initializeStorageStore(apiService)}, [isLoading])const initializeStorageStore = async (apiService: AutoApiService) => {+ if (isPaused) return+if (apiService.endpoint) {storageExplorerStore.initStore(projectRef,diff --git a/studio/components/layouts/TableEditorLayout/TableEditorLayout.tsx b/studio/components/layouts/TableEditorLayout/TableEditorLayout.tsxindex 5af32a7110e..af9d3c9d067 100644--- a/studio/components/layouts/TableEditorLayout/TableEditorLayout.tsx+++ b/studio/components/layouts/TableEditorLayout/TableEditorLayout.tsx@@ -1,4 +1,4 @@-import { PropsWithChildren, useEffect, useState } from 'react'+import { PropsWithChildren, useEffect } from 'react'import { useRouter } from 'next/router'import { noop } from 'lodash'import { observer } from 'mobx-react-lite'@@ -9,7 +9,7 @@ import { useParams } from 'common/hooks'import { Entity } from 'data/entity-types/entity-type-query'import { ENTITY_TYPE } from 'data/entity-types/entity-type-constants'import { useIsTableLoaded, useTableEditorStateSnapshot } from 'state/table-editor'-import ProjectLayout from '../ProjectLayout/ProjectLayout'+import ProjectLayout from '../'import TableEditorMenu from './TableEditorMenu'import NoPermission from 'components/ui/NoPermission'import useEntityType from 'hooks/misc/useEntityType'diff --git a/studio/components/layouts/index.ts b/studio/components/layouts/index.tsindex 7c64f282032..b5ffd3d933f 100644--- a/studio/components/layouts/index.ts+++ b/studio/components/layouts/index.ts@@ -1,7 +1,10 @@import AuthLayout from './AuthLayout/AuthLayout'import SignInLayout from './SignInLayout/SignInLayout'import ForgotPasswordLayout from './SignInLayout/ForgotPasswordLayout'-import ProjectLayout, { ProjectLayoutWithAuth } from './ProjectLayout/ProjectLayout'+import ProjectLayout, {+ ProjectLayoutWithAuth,+ ProjectLayoutNonBlocking,+} from './ProjectLayout/ProjectLayout'import TableEditorLayout from './TableEditorLayout/TableEditorLayout'import SQLEditorLayout from './SQLEditorLayout/SQLEditorLayout'import DatabaseLayout from './DatabaseLayout/DatabaseLayout'@@ -20,6 +23,7 @@ import OrganizationLayout from './OrganizationLayout'export {ProjectLayoutWithAuth,+ ProjectLayoutNonBlocking,AuthLayout,SignInLayout,ForgotPasswordLayout,diff --git a/studio/pages/project/[ref]/database/hooks/index.tsx b/studio/pages/project/[ref]/database/hooks/index.tsxindex d95c83a440d..4981cae2e65 100644--- a/studio/pages/project/[ref]/database/hooks/index.tsx+++ b/studio/pages/project/[ref]/database/hooks/index.tsx@@ -1,4 +1,5 @@import clsx from 'clsx'+import { IconLoader } from 'ui'import { useEffect, useState } from 'react'import { useRouter } from 'next/router'import { observer } from 'mobx-react-lite'@@ -14,8 +15,6 @@ import HooksList from 'components/interfaces/Database/Hooks/HooksList/HooksList'import DeleteHookModal from 'components/interfaces/Database/Hooks/DeleteHookModal'import EditHookPanel from 'components/interfaces/Database/Hooks/EditHookPanel'import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'-import AlphaPreview from 'components/to-be-cleaned/AlphaPreview'-import { IconLoader } from 'ui'const HooksPage: NextPageWithLayout = () => {const { meta, ui } = useStore()diff --git a/studio/pages/project/[ref]/index.tsx b/studio/pages/project/[ref]/index.tsxindex 44249b8cb22..af738885e0d 100644--- a/studio/pages/project/[ref]/index.tsx+++ b/studio/pages/project/[ref]/index.tsx@@ -36,7 +36,7 @@ const Home: NextPageWithLayout = () => {<ProjectUpgradeFailedBanner /></div>- {project?.status === PROJECT_STATUS.INACTIVE && <ProjectPausedState project={project} />}+ {project?.status === PROJECT_STATUS.INACTIVE && <ProjectPausedState />}<div className="mx-6">{IS_PLATFORM && project?.status !== PROJECT_STATUS.INACTIVE && <ProjectUsageSection />}diff --git a/studio/pages/project/[ref]/settings/api.tsx b/studio/pages/project/[ref]/settings/api.tsxindex 0446e3d361a..96df8c04768 100644--- a/studio/pages/project/[ref]/settings/api.tsx+++ b/studio/pages/project/[ref]/settings/api.tsx@@ -1,5 +1,4 @@import { createContext } from 'react'-import { useRouter } from 'next/router'import { observer, useLocalObservable } from 'mobx-react-lite'import { useStore } from 'hooks'@@ -12,7 +11,6 @@ export const PageContext: any = createContext(null)const ApiSettings: NextPageWithLayout = () => {const { ref } = useParams()-const { meta, ui } = useStore()const project = ui.selectedProjectdiff --git a/studio/pages/project/[ref]/settings/billing/subscription.tsx b/studio/pages/project/[ref]/settings/billing/subscription.tsxindex a47a62ad90d..7fb2343ca1b 100644--- a/studio/pages/project/[ref]/settings/billing/subscription.tsx+++ b/studio/pages/project/[ref]/settings/billing/subscription.tsx@@ -1,5 +1,4 @@import { observer } from 'mobx-react-lite'-import { FC, useEffect } from 'react'import { Loading } from 'ui'import { SettingsLayout } from 'components/layouts'@@ -7,18 +6,17 @@ import LoadingUI from 'components/ui/Loading'import OveragesBanner from 'components/ui/OveragesBanner/OveragesBanner'import { useStore } from 'hooks'import { useProjectSubscriptionQuery } from 'data/subscriptions/project-subscription-query'-import { NextPageWithLayout, Project } from 'types'+import { NextPageWithLayout } from 'types'import { Subscription } from 'components/interfaces/Billing'const ProjectBilling: NextPageWithLayout = () => {const { ui } = useStore()- const project = ui.selectedProjectreturn (<div className="w-full h-full overflow-y-auto content"><div className="w-full mx-auto">- <Settings project={project} />+ <Settings /></div></div>)@@ -30,27 +28,12 @@ ProjectBilling.getLayout = (page) => (export default observer(ProjectBilling)-interface SettingsProps {- project?: Project-}--const Settings: FC<SettingsProps> = ({ project }) => {+const Settings = () => {const { ui } = useStore()- const {- data: subscription,- isLoading: loading,- error,- } = useProjectSubscriptionQuery({ projectRef: ui.selectedProject?.ref })-- useEffect(() => {- if (error) {- ui.setNotification({- category: 'error',- message: `Failed to get project subscription: ${(error as any)?.message ?? 'unknown'}`,- })- }- }, [error])+ const { data: subscription, isLoading: loading } = useProjectSubscriptionQuery({+ projectRef: ui.selectedProject?.ref,+ })if (!subscription) {return <LoadingUI />@@ -60,13 +43,7 @@ const Settings: FC<SettingsProps> = ({ project }) => {<div className="container max-w-4xl p-4 space-y-8">{/* [Joshen TODO] Temporarily hidden until usage endpoint is sorted out */}{/* {projectTier !== undefined && <OveragesBanner tier={projectTier} />} */}- <Subscription- loading={loading}- project={project}- subscription={subscription}- currentPeriodStart={subscription?.billing.current_period_start}- currentPeriodEnd={subscription?.billing.current_period_end}- />+ <Subscription />{loading ? (<Loading active={loading}><div className="w-full mb-8 overflow-hidden border rounded border-panel-border-light dark:border-panel-border-dark">diff --git a/studio/stores/pgmeta/MetaStore.ts b/studio/stores/pgmeta/MetaStore.tsindex 8cc74c2ef02..1fe967c270c 100644--- a/studio/stores/pgmeta/MetaStore.ts+++ b/studio/stores/pgmeta/MetaStore.ts@@ -664,7 +664,6 @@ export default class MetaStore implements IMetaStore {// If the user is importing data via a spreadsheetif (!isUndefined(importContent)) {- console.log({ importContent })if (importContent.file && importContent.rowCount > 0) {// Via a CSV fileconst { error }: any = await this.insertRowsViaSpreadsheet(