Skip to content

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

chore: remove total_free_projects from User object

phamhieu26a176265fa2
diff --git a/studio/hooks/queries/useProfile.ts b/studio/hooks/queries/useProfile.ts
index 62782c163c8..3d5802391f8 100644
--- a/studio/hooks/queries/useProfile.ts
+++ b/studio/hooks/queries/useProfile.ts
@@ -22,7 +22,6 @@ export function useProfile(returning?: 'minimal') {
{
first_name: updatedUser.first_name,
last_name: updatedUser.last_name,
- total_free_projects: updatedUser.total_free_projects,
},
revalidate ?? true
)
diff --git a/studio/pages/index.tsx b/studio/pages/index.tsx
index 5fd19797cc7..1754fbd8c53 100644
--- a/studio/pages/index.tsx
+++ b/studio/pages/index.tsx
@@ -6,7 +6,7 @@ import { isUndefined } from 'lodash'
import { Typography } from '@supabase/ui'
import { Project } from 'types'
-import { useProfile, useStore, withAuth } from 'hooks'
+import { useStore, withAuth } from 'hooks'
import { post, delete_ } from 'lib/common/fetch'
import { API_URL, IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'
import { AccountLayout } from 'components/layouts'
@@ -22,7 +22,6 @@ const Home: NextPage = () => {
const { profile } = ui
const router = useRouter()
- const { mutateProfile } = useProfile()
const [isDeletingProject, setIsDeletingProject] = useState<boolean>(false)
const [selectedProjectToDelete, setSelectedProjectToDelete] = useState<Project>()
@@ -60,7 +59,7 @@ const Home: NextPage = () => {
return ui.setNotification({ category: 'error', message: response.error.message })
}
- app.onProjectDeleted(response, mutateProfile)
+ app.onProjectDeleted(response)
ui.setNotification({ category: 'success', message: `Deleted ${project.name} successfully!` })
setIsDeletingProject(false)
diff --git a/studio/pages/project/[ref]/settings/general.tsx b/studio/pages/project/[ref]/settings/general.tsx
index 1f72cc3c688..3b8f330b4df 100644
--- a/studio/pages/project/[ref]/settings/general.tsx
+++ b/studio/pages/project/[ref]/settings/general.tsx
@@ -17,7 +17,7 @@ import {
import { API_URL } from 'lib/constants'
import { pluckJsonSchemaFields, pluckObjectFields } from 'lib/helpers'
import { post, delete_ } from 'lib/common/fetch'
-import { useProfile, useStore, withAuth } from 'hooks'
+import { useStore, withAuth } from 'hooks'
import { SettingsLayout } from 'components/layouts'
import Panel from 'components/to-be-cleaned/Panel'
import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel'
@@ -173,7 +173,6 @@ const GeneralSettings = observer(() => {
const ProjectDeleteModal = ({ project }: any) => {
const router = useRouter()
- const { mutateProfile } = useProfile()
const { ui, app } = useStore()
const [isOpen, setIsOpen] = useState(false)
@@ -190,7 +189,7 @@ const ProjectDeleteModal = ({ project }: any) => {
try {
const response = await delete_(`${API_URL}/projects/${project.ref}/remove`)
if (response.error) throw response.error
- app.onProjectDeleted(response, mutateProfile)
+ app.onProjectDeleted(response)
ui.setNotification({ category: 'success', message: `Successfully deleted ${project.name}` })
router.push(`/`)
} catch (error: any) {
diff --git a/studio/stores/app/AppStore.ts b/studio/stores/app/AppStore.ts
index 4ce562ef5b8..235cdda2682 100644
--- a/studio/stores/app/AppStore.ts
+++ b/studio/stores/app/AppStore.ts
@@ -13,7 +13,7 @@ export interface IAppStore {
organizations: OrganizationStore
database: IDatabaseStore
onProjectUpdated: (project: any) => void
- onProjectDeleted: (project: any, mutateProfile: Function) => void
+ onProjectDeleted: (project: any) => void
onOrgAdded: (org: any) => void
onOrgUpdated: (org: any) => void
onOrgDeleted: (org: any) => void
@@ -52,22 +52,12 @@ export default class AppStore implements IAppStore {
}
}
- onProjectDeleted(project: any, mutateProfile: Function) {
+ onProjectDeleted(project: any) {
if (project && project.id) {
- const profile = this.rootStore.ui.profile
- const projectMetadata = this.projects.find((proj: any) => proj.id === project.id)
-
// cleanup project saved queries
localStorage.removeItem(`supabase-queries-state-${project.ref}`)
localStorage.removeItem(`supabase_${project.ref}`)
delete this.projects.data[project.id]
-
- if (profile && projectMetadata?.subscription_tier_prod_id === STRIPE_PRODUCT_IDS.FREE) {
- mutateProfile({
- ...profile,
- total_free_projects: profile.total_free_projects - 1,
- })
- }
}
}
diff --git a/studio/types/base.ts b/studio/types/base.ts
index f4ebb0b542f..cb08f2e82d9 100644
--- a/studio/types/base.ts
+++ b/studio/types/base.ts
@@ -36,7 +36,6 @@ export interface User {
last_name: string
is_alpha_user: boolean
free_project_limit: number
- total_free_projects: number
}
export interface Member {