Skip to content

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

Fix changing provider doesnt change default region (#27615)

Joshen Lim4b367a53ea7a
diff --git a/apps/studio/lib/constants/infrastructure.ts b/apps/studio/lib/constants/infrastructure.ts
index c7a15c75386..2a2666b8287 100644
--- a/apps/studio/lib/constants/infrastructure.ts
+++ b/apps/studio/lib/constants/infrastructure.ts
@@ -34,7 +34,7 @@ export const AWS_REGIONS_DEFAULT =
process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod' ? AWS_REGIONS.SOUTHEAST_ASIA : AWS_REGIONS.EAST_US
// TO DO, change default to US region for prod
-const FLY_REGIONS_DEFAULT = FLY_REGIONS.SOUTHEAST_ASIA
+export const FLY_REGIONS_DEFAULT = FLY_REGIONS.SOUTHEAST_ASIA
export const PRICING_TIER_LABELS_ORG = {
FREE: 'Free - $0/month',
diff --git a/apps/studio/pages/new/[slug].tsx b/apps/studio/pages/new/[slug].tsx
index dcb945491c3..3a6ac03bb37 100644
--- a/apps/studio/pages/new/[slug].tsx
+++ b/apps/studio/pages/new/[slug].tsx
@@ -25,9 +25,11 @@ import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-que
import generator from 'generate-password-browser'
import { useCheckPermissions, useFlag, withAuth } from 'hooks'
import {
+ AWS_REGIONS_DEFAULT,
CloudProvider,
DEFAULT_MINIMUM_PASSWORD_STRENGTH,
DEFAULT_PROVIDER,
+ FLY_REGIONS_DEFAULT,
PROJECT_STATUS,
PROVIDERS,
} from 'lib/constants'
@@ -530,7 +532,13 @@ const Wizard: NextPageWithLayout = () => {
render={({ field }) => (
<FormItemLayout label="Cloud provider" layout="horizontal">
<Select_Shadcn_
- onValueChange={field.onChange}
+ onValueChange={(value) => {
+ field.onChange(value)
+ form.setValue(
+ 'dbRegion',
+ value === 'FLY' ? FLY_REGIONS_DEFAULT : AWS_REGIONS_DEFAULT
+ )
+ }}
defaultValue={field.value}
>
<FormControl_Shadcn_>