The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fixes custom domains delete ui state not updating
Alaister Young865b4c31717a
diff --git a/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainConfig.tsx b/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainConfig.tsxindex 788554c1772..1f8cef56434 100644--- a/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainConfig.tsx+++ b/studio/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainConfig.tsx@@ -37,22 +37,10 @@ const CustomDomainConfig = () => {const isLoading = isSettingsLoading || isCustomDomainsLoading- const isNoHostnameConfiguredError =- isError &&- (error as any)?.code === 400 &&- (error as any)?.message?.includes('custom hostname configuration')-- const isNotAllowedError =- isError &&- (error as any)?.code === 400 &&- (error as any)?.message?.includes('not allowed to set up custom domain')-- const isUnknownError = isError && !isNoHostnameConfiguredError && !isNotAllowedError-return (<section><FormHeader title="Custom Domains" description="" />- {isNoHostnameConfiguredError ? (+ {data?.status === '0_no_hostname_configured' ? (<CustomDomainsConfigureHostname projectRef={ref} />) : (<Panel>@@ -62,7 +50,7 @@ const CustomDomainConfig = () => {</Panel.Content>)}- {isNotAllowedError && (+ {data?.status === '0_not_allowed' && (<Panel.Content className="space-y-6"><UpgradeToProicon={<IconAlertCircle size={18} strokeWidth={1.5} />}@@ -73,7 +61,7 @@ const CustomDomainConfig = () => {</Panel.Content>)}- {isUnknownError && (+ {isError && (<Panel.Content className="space-y-6"><div className="flex items-center justify-center space-x-2 py-8"><IconAlertCircle size={16} strokeWidth={1.5} />diff --git a/studio/data/custom-domains/custom-domains-delete-mutation.ts b/studio/data/custom-domains/custom-domains-delete-mutation.tsindex ff8a0dae966..014ce571e4d 100644--- a/studio/data/custom-domains/custom-domains-delete-mutation.ts+++ b/studio/data/custom-domains/custom-domains-delete-mutation.ts@@ -40,7 +40,15 @@ export const useCustomDomainDeleteMutation = ({async onSuccess(data, variables, context) {const { projectRef } = variables- await queryClient.invalidateQueries(customDomainKeys.list(projectRef))+ // we manually setQueriesData here instead of using+ // the standard invalidateQueries is the custom domains+ // endpoint doesn't immediately return the new state+ queryClient.setQueriesData(customDomainKeys.list(projectRef), () => {+ return {+ customDomain: null,+ status: '0_no_hostname_configured',+ }+ })await onSuccess?.(data, variables, context)},diff --git a/studio/data/custom-domains/custom-domains-query.ts b/studio/data/custom-domains/custom-domains-query.tsindex 78c41c3426a..645f756b8be 100644--- a/studio/data/custom-domains/custom-domains-query.ts+++ b/studio/data/custom-domains/custom-domains-query.ts@@ -8,6 +8,8 @@ export type CustomDomainsVariables = {}type CustomDomainStatus =+ | '0_not_allowed'+ | '0_no_hostname_configured'| '1_not_started'| '2_initiated'| '3_challenge_verified'@@ -87,6 +89,32 @@ export async function getCustomDomains(}if (response.error) {+ // not allowed error and no hostname configured error are+ // valid steps in the process of setting up a custom domain+ // so we convert them to data instead of errors++ const isNotAllowedError =+ (response.error as any)?.code === 400 &&+ (response.error as any)?.message?.includes('not allowed to set up custom domain')++ if (isNotAllowedError) {+ return {+ customDomain: null,+ status: '0_not_allowed',+ } as const+ }++ const isNoHostnameConfiguredError =+ (response.error as any)?.code === 400 &&+ (response.error as any)?.message?.includes('custom hostname configuration')++ if (isNoHostnameConfiguredError) {+ return {+ customDomain: null,+ status: '0_no_hostname_configured',+ } as const+ }+throw response.error}