Skip to content

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

remove useSubscriptionStats

Alaister Young3f24a427ef7a
diff --git a/studio/hooks/queries/index.ts b/studio/hooks/queries/index.ts
index 212d8be36a8..a81712a02cf 100644
--- a/studio/hooks/queries/index.ts
+++ b/studio/hooks/queries/index.ts
@@ -1,2 +1 @@
export * from './useProjectSubscription'
-export * from './useSubscriptionStats'
diff --git a/studio/hooks/queries/useSubscriptionStats.ts b/studio/hooks/queries/useSubscriptionStats.ts
deleted file mode 100644
index e109b160077..00000000000
--- a/studio/hooks/queries/useSubscriptionStats.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import useSWR, { mutate } from 'swr'
-import { get } from 'lib/common/fetch'
-import { API_URL } from 'lib/constants'
-
-export interface SubscriptionStats {
- total_paid_projects: number
- total_free_projects: number
- total_active_free_projects: number
- total_paused_free_projects: number
- total_pro_projects: number
- total_payg_projects: number
-}
-
-export function useSubscriptionStats() {
- const url = `${API_URL}/profile/subscriptions`
- const { data, error } = useSWR<any>(url, get)
- const anyError = data?.error || error
-
- return {
- total_paid_projects: data?.total_paid_projects ?? 0,
- total_free_projects: data?.total_free_projects ?? 0,
- total_active_free_projects: data?.total_active_free_projects ?? 0,
- total_paused_free_projects: data?.total_paused_free_projects ?? 0,
- total_pro_projects: data?.total_pro_projects ?? 0,
- total_payg_projects: data?.total_payg_projects ?? 0,
- isLoading: !anyError && !data,
- isError: !!anyError,
- }
-}
diff --git a/studio/pages/new/[slug].tsx b/studio/pages/new/[slug].tsx
index 64bf710eff1..9702dca4aac 100644
--- a/studio/pages/new/[slug].tsx
+++ b/studio/pages/new/[slug].tsx
@@ -21,14 +21,7 @@ import {
PRICING_TIER_FREE_KEY,
PRICING_TIER_PRODUCT_IDS,
} from 'lib/constants'
-import {
- useStore,
- useFlag,
- withAuth,
- useSubscriptionStats,
- checkPermissions,
- useParams,
-} from 'hooks'
+import { useStore, useFlag, withAuth, checkPermissions, useParams } from 'hooks'
import { useFreeProjectLimitCheckQuery } from 'data/organizations/free-project-limit-check-query'
import { WizardLayoutWithoutAuth } from 'components/layouts'
@@ -48,7 +41,6 @@ const Wizard: NextPageWithLayout = () => {
const projectCreationDisabled = useFlag('disableProjectCreationAndUpdate')
const kpsEnabled = useFlag('initWithKps')
- const subscriptionStats = useSubscriptionStats()
const { data: membersExceededLimit, isLoading: isLoadingFreeProjectLimitCheck } =
useFreeProjectLimitCheckQuery({ slug })
@@ -75,10 +67,7 @@ const Wizard: NextPageWithLayout = () => {
const hasMembersExceedingFreeTierLimit = (membersExceededLimit || []).length > 0
const canCreateProject =
- isAdmin &&
- !subscriptionStats.isError &&
- !subscriptionStats.isLoading &&
- (!isSelectFreeTier || (isSelectFreeTier && !hasMembersExceedingFreeTierLimit))
+ isAdmin && (!isSelectFreeTier || (isSelectFreeTier && !hasMembersExceedingFreeTierLimit))
const canSubmit =
projectName !== '' &&
@@ -203,11 +192,7 @@ const Wizard: NextPageWithLayout = () => {
return (
<Panel
hideHeaderStyling
- loading={
- !app.organizations.isInitialized ||
- subscriptionStats.isLoading ||
- isLoadingFreeProjectLimitCheck
- }
+ loading={!app.organizations.isInitialized || isLoadingFreeProjectLimitCheck}
title={
<div key="panel-title">
<h3>Create a new project</h3>