The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: invalidate free project limit checks for all organizations when a project is deleted (#47569)
Ivan Vasilov0bcd2e196db1
diff --git a/apps/studio/data/projects/project-delete-mutation.ts b/apps/studio/data/projects/project-delete-mutation.tsindex 97fc816a1d7..08b4963dd29 100644--- a/apps/studio/data/projects/project-delete-mutation.ts+++ b/apps/studio/data/projects/project-delete-mutation.ts@@ -37,7 +37,19 @@ export const useProjectDeleteMutation = ({return useMutation<ProjectDeleteData, ResponseError, ProjectDeleteVariables>({mutationFn: (vars) => deleteProject(vars),async onSuccess(data, variables, context) {- await Promise.all([queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.ref) })])+ // Free project limits are shared across all of a user's orgs, so clear the cached+ // check for every org, not just the one the deleted project belonged to.+ const freeProjectLimitCheckQueries = queryClient+ .getQueryCache()+ .findAll({ queryKey: ['organizations'] })+ .filter((query) => query.queryKey[2] === 'free-project-limit-check')++ await Promise.all([+ queryClient.invalidateQueries({ queryKey: projectKeys.detail(data.ref) }),+ ...freeProjectLimitCheckQueries.map((query) =>+ queryClient.invalidateQueries({ queryKey: query.queryKey })+ ),+ ])if (variables.organizationSlug) {await Promise.all([@@ -45,9 +57,6 @@ export const useProjectDeleteMutation = ({queryClient.invalidateQueries({queryKey: organizationKeys.detail(variables.organizationSlug),}),- queryClient.invalidateQueries({- queryKey: organizationKeys.freeProjectLimitCheck(variables.organizationSlug),- }),])}