The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
[FE-4067] fix(studio): re-allow all regions in local project creation (#48704)
Alaister Young9952d6f10fb9
diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.ts b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.tsindex cb820643b13..ec08c1218ef 100644--- a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.ts+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.ts@@ -24,15 +24,18 @@ describe('High Availability project creation constraints', () => {})it.each([- ['local', 'eu-central-1'],+ ['local', undefined],['staging', 'us-east-1'],['prod', undefined],- ])('limits %s projects to the required region', (environment, expectedRegion) => {- const regions = [{ code: 'us-east-1' }, { code: 'eu-central-1' }]+ ])(+ 'applies the %s region restriction to high availability projects',+ (environment, expectedRegion) => {+ const regions = [{ code: 'us-east-1' }, { code: 'eu-central-1' }, { code: 'ap-southeast-1' }]- expect(filterHighAvailabilityRegions(regions, true, environment)).toEqual(- expectedRegion === undefined ? regions : [{ code: expectedRegion }]- )- expect(filterHighAvailabilityRegions(regions, false, environment)).toEqual(regions)- })+ expect(filterHighAvailabilityRegions(regions, true, environment)).toEqual(+ expectedRegion === undefined ? regions : [{ code: expectedRegion }]+ )+ expect(filterHighAvailabilityRegions(regions, false, environment)).toEqual(regions)+ }+ )})diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.tsindex a316856a645..a99780d99c7 100644--- a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts@@ -47,8 +47,9 @@ export const instanceLabel = (instance: string | undefined): string => {export const getHighAvailabilityRegionCode = (environment = process.env.NEXT_PUBLIC_ENVIRONMENT) => {- if (environment === 'local') return 'eu-central-1'+ // Local dev stacks can run in any of the supported regions, so they're left unrestrictedif (environment === 'staging') return 'us-east-1'+ if (environment === 'local') return 'eu-central-1'return undefined}@@ -57,8 +58,9 @@ export const filterHighAvailabilityRegions = <T extends { code: string }>(highAvailability: boolean,environment = process.env.NEXT_PUBLIC_ENVIRONMENT) => {+ const isLocal = environment === 'local'const regionCode = getHighAvailabilityRegionCode(environment)- return highAvailability && regionCode !== undefined+ return highAvailability && !isLocal && regionCode !== undefined? regions.filter((region) => region.code === regionCode): regions}diff --git a/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx b/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsxindex 42119e81ffa..55f5898d54c 100644--- a/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx+++ b/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx@@ -69,6 +69,8 @@ const getDisplayNameForSmartRegion = (name: string): string => {return name}+const isLocal = process.env.NEXT_PUBLIC_ENVIRONMENT === 'local'+export const RegionSelector = ({form,instanceSize,@@ -104,7 +106,7 @@ export const RegionSelector = ({const allSmartRegions = availableRegionsData?.all.smartGroup ?? []const allRegions = availableRegionsData?.all.specific ?? []const restrictHighAvailabilityRegion =- highAvailability && highAvailabilityRegionCode !== undefined+ highAvailability && !isLocal && highAvailabilityRegionCode !== undefinedconst smartRegions = highAvailability ? [] : allSmartRegionsconst recommendedSmartRegions = new Set(@@ -131,9 +133,8 @@ export const RegionSelector = ({)const isLoading = smartRegionEnabled ? isLoadingAvailableRegions : isLoadingDefaultRegion- const showNonProdFields =- process.env.NEXT_PUBLIC_ENVIRONMENT === 'local' ||- process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging'+ const isLocalEnvironment = process.env.NEXT_PUBLIC_ENVIRONMENT === 'local'+ const showNonProdFields = isLocalEnvironment || process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging'const allSelectableRegions = [...smartRegions, ...regionOptions]@@ -220,6 +221,11 @@ export const RegionSelector = ({<li>Central EU (Frankfurt)</li><li>Southeast Asia (Singapore)</li></ul>+ {isLocalEnvironment && (+ <p className="mt-1">+ Use Central EU (Frankfurt) unless you're on a personal dev stack.+ </p>+ )}</div>))}