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) {