Skip to content

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

feat(billing): invalidate addons query when custom domain is deleted (#39967)

Kanishk Dudeja383f00e30260
diff --git a/apps/studio/data/custom-domains/custom-domains-delete-mutation.ts b/apps/studio/data/custom-domains/custom-domains-delete-mutation.ts
index 2cd70feb212..8a28cb320a3 100644
--- a/apps/studio/data/custom-domains/custom-domains-delete-mutation.ts
+++ b/apps/studio/data/custom-domains/custom-domains-delete-mutation.ts
@@ -2,6 +2,7 @@ import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react
import { toast } from 'sonner'
import { del, handleError } from 'data/fetchers'
+import { subscriptionKeys } from 'data/subscriptions/keys'
import type { ResponseError } from 'types'
import { customDomainKeys } from './keys'
@@ -47,6 +48,9 @@ export const useCustomDomainDeleteMutation = ({
}
})
+ // Invalidate addons cache since the backend removes the addon when deleting the domain
+ await queryClient.invalidateQueries({ queryKey: subscriptionKeys.addons(projectRef) })
+
await onSuccess?.(data, variables, context)
},
async onError(data, variables, context) {