Skip to content

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

Fix deleting project not refreshing list of projects in home page (#38890)

Joshen Lim4b978acc83c8
diff --git a/apps/studio/data/projects/keys.ts b/apps/studio/data/projects/keys.ts
index cee23b35a41..e9c74a3a8f7 100644
--- a/apps/studio/data/projects/keys.ts
+++ b/apps/studio/data/projects/keys.ts
@@ -2,13 +2,13 @@ export const projectKeys = {
list: () => ['all-projects'] as const,
infiniteListByOrg: (
slug: string | undefined,
- params: {
+ params?: {
limit: number
sort?: 'name_asc' | 'name_desc' | 'created_asc' | 'created_desc'
search?: string
statuses?: string[]
}
- ) => ['all-projects-infinite', slug, params] as const,
+ ) => ['all-projects-infinite', slug, params].filter(Boolean),
status: (projectRef: string | undefined) => ['project', projectRef, 'status'] as const,
types: (projectRef: string | undefined) => ['project', projectRef, 'types'] as const,
detail: (projectRef: string | undefined) => ['project', projectRef, 'detail'] as const,
diff --git a/apps/studio/data/projects/project-delete-mutation.ts b/apps/studio/data/projects/project-delete-mutation.ts
index 31e2a941aa2..8e58ac28a86 100644
--- a/apps/studio/data/projects/project-delete-mutation.ts
+++ b/apps/studio/data/projects/project-delete-mutation.ts
@@ -2,9 +2,9 @@ import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react
import { toast } from 'sonner'
import { del, handleError } from 'data/fetchers'
+import { organizationKeys } from 'data/organizations/keys'
import type { ResponseError } from 'types'
import { projectKeys } from './keys'
-import { organizationKeys } from 'data/organizations/keys'
export type ProjectDeleteVariables = {
projectRef: string
@@ -39,6 +39,10 @@ export const useProjectDeleteMutation = ({
await queryClient.invalidateQueries(projectKeys.list())
if (variables.organizationSlug) {
+ await queryClient.invalidateQueries(
+ projectKeys.infiniteListByOrg(variables.organizationSlug)
+ )
+
queryClient.invalidateQueries(
organizationKeys.freeProjectLimitCheck(variables.organizationSlug)
)