From 383f00e30260d58c19cd641e3880ec79253d541a Mon Sep 17 00:00:00 2001 From: Kanishk Dudeja Date: Wed, 29 Oct 2025 16:52:25 +0530 Subject: [PATCH] feat(billing): invalidate addons query when custom domain is deleted (#39967) --- .../data/custom-domains/custom-domains-delete-mutation.ts | 4 ++++ 1 file changed, 4 insertions(+) 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) {